MarkusSagen / the-hatchlor

🌹 Cookiecutter template featuring the modern and extensible Python project manager hatch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🌹 The Hatchlor 🌹 Cookiecutter Template

The Hatchlor logo
Details Tests License - MIT GitHub Sponsors
Features Hatch project linting - Ruff types - mypy test - pytest linting - precommit docs - mkdocs

The Hatchlor is a cookiecutter template featuring the modern and extensible Python project manager hatch 🐣.

With hatch, you no longer need to deal with files like requirements.txt, Pipfile or environment.yml, just configure everything in pyproject.toml. Thus, hatch is a sophisticated alternative to pipenv, poetry, conda, or direct virtualenv usage. Just think of hatch as a tool that allows you to easily define many isolated development environments, e.g. virtual but also docker environments, and helps you to manage them. A bit like what tox does for testing environments but for all kinds of environments, e.g. testing, linting your code, buildings your docs, and whatever you want.

Check out a vanilla Python project created by the Hatchlor.

✨ Features

The Hatchlor integrates the following features:

  • hatch: Python packaging, environment management and test runner,
  • hatch-vcs: determine the package version automatically from git tags, e.g. v0.9,
  • hatch-pip-compile: experimental support for lock-files,
  • pyproject.toml: all package, build and tool configuration in one file,
  • pytest: full-featured Python testing tool that helps you write better programs,
  • coverage: tool for measuring code coverage of Python programs with pytest integration,
  • ruff: extremely fast Python linter/formatter, which replaces isort, flake8, black, etc.,
  • mypy: optional static type checker for Python,
  • mkdocs: a fast, simple and downright gorgeous static site generator,
  • 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 src folder avoiding many common errors.

The template includes a skeleton.py with a simple function fib that calculates the Fibonacci numbers as demonstration. This is tested with tests/test_skeleton.py to demonstrate the corresponding features from above. As an additional tidbit, skeleton.py also features Typer to show how fib can be exposed as a CLI command. These files are only for demonstration and can be safely deleted.

πŸ’« Quickstart

Install the latest cookiecutter, i.e. >= 1.4, if not installed:

pip install -U cookiecutter

Then generate your Python project with:

cookiecutter https://github.com/florianwilhelm/the-hatchlor.git

πŸŽ‰ That's it! Now change into the created directory and check out README.md for more information.

πŸͺͺ License

The Hatchlor is distributed under the terms of the MIT license.

πŸ™ Credits

To start this project off a lot of inspiration was taken from hatch, cookiecutter-pypackage and Pyscaffold.

About

🌹 Cookiecutter template featuring the modern and extensible Python project manager hatch

License:MIT License


Languages

Language:Python 66.8%Language:Jupyter Notebook 28.8%Language:Shell 4.5%