Cookiecutter opinionated template for a Python package compliant with zurutech/styleguide.
- Testing setup with pytest
- Travis-CI: Ready for Travis Continuous Integration testing
- Sphinx docs: Documentation ready for generation with, for example, ReadTheDocs
- Read the Docs Sphinx Theme
- Google Style Docstrings
- Type hints for
autodoc
via sphinx-autodoc-typehints - Dependency Graph
- Integrate Markdown and RST via m2r
- sphinx-copybutton
- doc8 and pydocstyle
- Opinionated configurations enforcing compliance with zurutech/styleguide for:
- isort
- pylint
- flake8 extended via flake8-bugbear
- Easy refactoring with rope
- Modular requirements.in structure to be used with reqompyler or pip-tools
- Auto-release to PyPI when you push a new tag to master (optional)
- Command line interface using Click (optional)
This is the flow we reccommend for new projects.
Install the latest Cookiecutter if you haven't installed it yet (this requires Cookiecutter 1.4.0 or higher):
pip install -U cookiecutter
Generate a Python package project:
cookiecutter https://github.com/zurutech/cookiecutter-pypackage.git
Then:
- Create a GitHub repo and put it there.
- Expand on the copmatible Python versions that your package support by specifying them in
in the
setup.py
file while also testing for them via Tox and Travis-CI. - Add license headers to your project using licenseheaders.
- Add the repo to your Travis-CI account.
- Register your project with PyPI.
- Run the Travis CLI command
travis encrypt --add deploy.password
to encrypt your PyPI API token in Travis config and activate automated deployment on PyPI when you push a new tag to master branch. - Add the repo to your ReadTheDocs account + turn on the ReadTheDocs service hook.
- Release your package by pushing a new tag to master.
- Activate your project on pyup.io (pyup.io is a service that helps in keeping dependencies fresh by automatically generating a PR whenever one of them gets a new release, it's free for public repos).
For more details, see the cookiecutter-pypackage tutorial.
Don't worry, you have options:
- audreyr/cookiecutter-pypackage: The One and only. This is the original
pypackage
Cookiecutter. zurutech/cookiecutter-pypackage started as an internal fork of this one and became more opinionated over time. - ionelmc/cookiecutter-pylibrary: Cookiecutter template for a Python python library. Extremely configurable. zurutech/cookiecutter-pypackage is a cross between this and audreyr/cookiecutter-pypackage
- Nekroze/cookiecutter-pypackage: A fork of this with a PyTest test runner, strict flake8 checking with Travis/Tox, and some docs and setup.py differences.
- tony/cookiecutter-pypackage-pythonic: Fork with py2.7+3.3 optimizations.
Flask/Werkzeug-style test runner,
_compat
module and module/doc conventions. SeeREADME.rst
or the github comparison view for exhaustive list of additions and modifications. - ardydedase/cookiecutter-pypackage: A fork with separate requirements files rather
than a requirements list in the
setup.py
file. - lgiordani/cookiecutter-pypackage: A fork of Cookiecutter that uses Punch instead of Bumpversion and with separate requirements files.
- Also see the network and family tree for this repo. (If you find anything that should be listed here, please add it and send a pull request!)
If you have differences in your preferred setup, I encourage you to fork this to create your own version. Or create your own; it doesn't strictly have to be a fork.
- Once you have your own version working, add it to the Similar Cookiecutter Templates list above with a brief description.
- It's up to you whether or not to rename your fork/own version. Do whatever you think sounds good.