/cookiecutter-pypackage-minimal

My forked minimal cookiecutter template for python packages

Primary LanguagePythonMIT LicenseMIT

cookiecutter-pypackage-minimal

My forked, opinionated take on a minimal cookiecutter template for Python packages.

Usage

will need cookiecutter

  pip install cookiecutter

create local repo using the cookiecutter template in this repo

  cookiecutter https://github.com/katzy687/cookiecutter-pypackage-minimal.git

See cookicutter.json for all parameters that are passed into the template.

Python Versions

Defaults to python 3.9. Can provide a custom override and will be forwarded to multiple files in template. The full list of PyPI classifiers can be found here.

  • NOTE: due to Jinja Templating restriction, can't parametrize python version inside .github workflow files
    • Change manually if needed after template generation

Testing

  • Uses pytest as the default test runner
  • Use Tox to manage test environments
  • Define testing dependencies in tox.ini
  • tests directory should not be a package

Precommit and Linting

Use pre-commit as the lint and formatter runner, both locally and in Github Actions CI. See .pre-commit-config.yaml file for default linter settings and to modify to exclude files etc.

**Uses the following formatters / linters, listed in requirements-dev.txt:

Github Actions

  • Some default workflows for linting and release packaging are included.
  • Pushes to all branches triggers linting workflow.
  • Pushing tags that start with "v" will kick off release workflow.
  • To upload package to Pypi, must add Repository secrets PYPI_API_TOKEN and TEST_PYPI_TOKEN
  • Release Changelog Builder for adding PR details to releases. Add more labels to changelog_config.json and then confirm that labels exist in repo.
  • Add some Git Emojis to commits and CI jobs ⚡️

Versioning And Release

Use Bump2version to bump version.txt and create matching "v" release tag. Pushing this tag will kick off CI flow for release See .bumpversion.cfg for additional settings

LICENSE

  • MIT license by default This template provides you the classic MIT licence: it lets people do almost anything they want with your project, including to make and distribute closed source versions. If you choose another license, you also need to update setup.py