Cookiecutter template for a cutting-edge Python package: Hatch, ruff, mypy, GitHub Actions and more!
| Details | |
| Features |
- Lightweight starter
-
Hatchpackage management - hatch-vcs: determine the package version automatically from git tags, e.g.
v0.9 - Linting and formatting with
ruffwhich replaces isort, flake8, black, etc. - Type checking with
mypy - Check unused, missing and transitive dependencies with
deptry - Unit tests with
pytestwith optional asyncio setup. - Automate and standardize testing with Hatch-env-matrices
- Documentation with Material for MkDocs and docstring reference support with mkdocstrings.
- Ready-to-use GitHub Actions pipelines with
dependabot,release-drafter,labeler,publish to PYPI workflows,publish to test PYPI workflows& more. - hatch-pip-compile: experimental support for lock-files,
- pyproject.toml: all package, build and tool configuration in one file,
- coverage: tool for measuring code coverage of Python programs with pytest integration,
- pre-commit: pre-commit git hooks that make your life easier,
- Markdown: instead of reStructuredText, Markdown is used consistently for all text files,
- EditorConfig: maintain consistent coding styles for multiple developers,
- src-layout: the actual Python package is kept under a
srcfolder avoiding many common errors.
Generate the project:
This project will use pipx to install hatch in an isolated enviroment. Make sure you have pipx installed before running the following command.
cookiecutter https://github.com/Aviksaikat/cookiecutter-hatch-pypackageThe generator will automatically call hatch env create & git init at the end.
Then, for the GitHub Actions pipelines to work correctly, you should:
- Enable the GitHub repository in
Codecov. - Set
CODECOV_TOKENin your GitHub repository secrets. You can find in the Codecov settings of the corresponding project. - Enable
GitHub Pagesusing theGitHub Actionssource. - Option to publish to Test
PyPIfor testing. - Configure the Trusted Publisher method on PyPI: it's a modern and secure method to push your package to PyPI.
cruft is a layer above Cookiecutter allowing you to update your project from the template after it has been generated.
cruft create https://github.com/Aviksaikat/cookiecutter-hatch-pypackageThis project is licensed under the terms of the MIT license.
