Skip to content

Commit

Permalink
Create project boilerplate
Browse files Browse the repository at this point in the history
Define the project toolset with pre-commit:

- The Black formatter;
- The style enforcer flake8;
- The linter pylint.

As described online [1], pylint raises a false positive about line
continuation when using the black formatter.  Also set the maximum
line length to what black uses (88 characters).

[1]: pylint-dev/pylint#289
  • Loading branch information
bibz committed Feb 4, 2019
1 parent ef6c2f7 commit 510c6b4
Show file tree
Hide file tree
Showing 7 changed files with 839 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,35 @@
---
repos:
-
repo: https://github.com/ambv/black
rev: stable
hooks:
-
id: black
language_version: python3.6
-
repo: https://gitlab.com/pycqa/flake8
rev: 3.7.4
hooks:
-
id: flake8
additional_dependencies:
- flake8-docstrings
- flake8-comprehensions
- flake8-rst
- pep8-naming
-
# Use the pylint mirror until issue with black is solved
# (https://github.com/PyCQA/pylint/issues/289).
repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.2.2
hooks:
- id: pylint
-
repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: check-yaml
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions README.rst
@@ -0,0 +1,71 @@
=============
Mini Vouchers
=============

A minimal implementation of a voucher system.

Usage
-----

TODO

Installation
------------

Simply install using the setup command, e.g. within a virtual environment:

.. code-block:: shell
$ virtualenv -p python3 venv
$ . ./venv/bin/activate
(venv)$ pip install .
Requirements
^^^^^^^^^^^^

Python 3.6 is required.

Development
^^^^^^^^^^^

The Python files are formatted with `Black`_ and linted with `flake8`_ and
`pylint`_.
A `pre-commit`_ hook is defined to automate the mundane work.

To start developing, initialise the development environment and install the
pre-commit hook with:

.. code-block:: shell
$ virtualenv -p python3 venv
$ . ./venv/bin/activate
(venv)$ pip install -r requirements-dev.txt
(venv)$ pre-commit install
License
-------

This project is free software and licensed under the GNU General Public License
v3 or later.

Authors
-------

`mini-vouchers` was written by `Borjan Tchakaloff <borjan@tchakaloff.fr>`_.

Credits
-------

This package was created with `Cookiecutter`_ and is based on the
`audreyr/cookiecutter-pypackage`_ and
`kragniz/cookiecutter-pypackage-minimal`_ project templates.

.. _`Black`: https://github.com/ambv/black
.. _`Cookiecutter`: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`:
https://github.com/audreyr/cookiecutter-pypackage
.. _`flake8`: https://gitlab.com/pycqa/flake8
.. _`kragniz/cookiecutter-pypackage-minimal`:
https://github.com/kragniz/cookiecutter-pypackage-minimal
.. _`pre-commit`: https://pre-commit.com
.. _`pylint`: https://github.com/PyCQA/pylint
8 changes: 8 additions & 0 deletions pylintrc
@@ -0,0 +1,8 @@
[FORMAT]

# Maximum number of characters on a single line.
max-line-length=88

# Disable C0330 as there are currently some false positives:
# https://github.com/PyCQA/pylint/issues/289
disable=C0330
3 changes: 3 additions & 0 deletions requirements-dev.txt
@@ -0,0 +1,3 @@
-e .

pre-commit
46 changes: 46 additions & 0 deletions setup.py
@@ -0,0 +1,46 @@
#!/usr/bin/env python
#
# Copyright 2019 Borjan Tchakaloff
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

"""The setup script."""

from setuptools import setup, find_packages


with open("README.rst") as readme_file:
README = readme_file.read()


setup(
author="Borjan Tchakaloff",
author_email="borjan@tchakaloff.fr",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Natural Language :: English",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
],
description="A minimal implementation of a voucher system.",
license="GNU General Public License v3 or later",
long_description=README,
name="mini-vouchers",
packages=find_packages(include=["mini_vouchers"]),
python_requires="~=3.6",
version="0.1.0",
)
2 changes: 2 additions & 0 deletions tox.ini
@@ -0,0 +1,2 @@
[flake8]
max-line-length=88

0 comments on commit 510c6b4

Please sign in to comment.