This repository holds a minimal but complete python3 package
with the following quality services already included:
setuptoolsflow for packaging;unittesttest suite sub-package suited for Test Driven Development;coveragefor test suite;banditandsafetyfor security tests;pylintandflake8for syntax checks;mypyfor type hints checks and errors;blackandisortfor code formatting;jupyternotebooks rendering (with Sphinx integration);Sphinxdocumentation builder;anybadgefor any session badges;noxfor session coordination;- GitLab CI Pipeline and GitHub Workflow (future).
To start a new project from this package few steps are required:
- Fork this repository to your hub account and rename it;
- Clone the forked repository to your workspace;
- Rename the project by renaming the package directory;
- Start to implement your project as usual.
Running Code Quality tool suite for this package requires
Code Quality packages are installed (defined in ./docs/requirements.txt):
python -m pip install -r ./docs/requirements_ci.txtCode Quality environment is also available in a dedicated Docker image.
Then, to check package capabilities (aka nox sessions), issue:
nox --list
- clean -> Package Code Cleaner
- package -> Package Builds (badge)
- install -> Package Installer
- uninstall -> Package Uninstaller
* tests -> Package Test Suite Report (badge)
* coverage -> Package Test Suite Coverage Report (badge)
* security -> Package Security Report (badges)
* linter -> Package Linter Report (badge)
* syntax -> Package Syntax Report (badge)
* types -> Package Type Hints Report (badge)
* styles -> Package Code Styles Report (badge)
- notebooks -> Package Notebooks (badge)
- docs -> Package Documentation (badge)Create a virtual environment if required and activate it:
python3 -m virtualenv venv
source venv/bin/activateThis package follows the usual setuptools flow, installation is as simple as:
python3 setup.py installThis will install dependencies as well (as defined in requirements.txt).
To build a wheel and install from it, then issue:
nox --session package installThis package uses unittest to create its test suite,
to run the complete package test suite, issue:
nox --session testsThis package uses coverage to assess code coverage.
To run the test suite coverage, issue:
nox --session coverageThis package uses bandit for security checks.
To check package python security know vulnerabilities, issue:
nox --session security safetyThis package uses pylint and flake8 for syntax checks.
To check package python syntax, issue:
nox --session linter syntaxThis package uses mypy to check types hints.
To check type hints and common errors, issue:
nox --session typesThis package uses black and isort to check or coerce python code styles.
To check if your code is black, issue:
nox --session stylesTo actually style the package code inplace, issue:
nox --session cleanThis package uses jupyter notebooks for tests and documentation purposes.
To refresh all notebooks, issue:
nox --session notebooksNote: it will rely on previously defined virtual environment venv.
This package uses Sphinx to build documentation. To generate the package documentation, issue:
nox --session docsAll badges are automatically generated for each nox
session using anybadge and related report
contents (see noxfile.py for details).