/pytemplate

Package generator for a pip python packages with tox tests, code coverage, autoformat, format checking, type checking, doc generation

Primary LanguagePythonMIT LicenseMIT

pytemplate

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

Development

Installing sources projects

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

Run tests

pip install tox
tox

Generate documentation:

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