Template for a pip python package with:
- tox pytest based unit tests
- pytest code coverage
- isort/black autoformat
- flake8 format checking
- mypy type checking
- sphinx doc generation
To use this template and create a new project:
git clone https://github.com/vche/pytemplate.git
./templatize.sh $NEW_PROJECT_NAME $NEW_PROJECT_PATH
The new project will be created in $NEW_PROJECT_PATH/$NEW_PROJECT_NAME To run test and generate doc, see README
Get the project and create the virtual env:
git clone https://github.com/vche/TEMPLATE_PACKAGE_NAME.git
virtualenv pyvenv
. pyvenv/bin/activate
pip install -e .
Note: Entry points will be installed in pyvenv/bin, libs with pyvenv libs
pip install tox
tox
pip install sphinx sphinx_rtd_theme m2r
./setup.py doc
In case new classes/modules are added, update the autodoc list:
rm docs/sphinx_conf/source/*
sphinx-apidoc -f -o docs/sphinx_conf/source/ src/TEMPLATE_PACKAGE_NAME