pip install cookiecutter
cookiecutter gh:KingMichaelPark/hatch-python-cookiecutter
To work with your project you can drop into a shell that keeps your
dependencies synced with the entries in your pyproject.toml
file. You can have
dependency groups there that allow for custom shells.
You can enter a shell simply with:
hatch shell
# You can still run other shell commands such as git helpers from within the shell
hatch run git:commit
Project dependencies for the build can be listed with:
❯ hatch dep show table
Env: default
┏━━━━━━━━━━━━┓
┃ Name ┃
┡━━━━━━━━━━━━┩
│ black │
│ pytest │
│ pytest-cov │
│ ruff │
└────────────┘
You can update these and include sub shells in your pyproject.toml. Environments
Working on the project source code with code-completion can be done by simply
calling: hatch shell
.
Commitzen is used to handle the version bumping (Hatch can do this as well but doesn't get git tags by default)^1
hatch run git:version
(It is really a wrapper for cz bump {args}
)
❯ hatch run git:version --help
Helper functions for nice commit messages are also built-in using commitizen.
hatch run git:commit
Hatch complies with modern Python packaging specs and therefore your projects can be used by other tools with Hatch serving as just the build backend.
Invoking the build command without any arguments will build the sdist and wheel targets:
hatch build
After your project is built, you can distribute it using the publish command.
The -p/--publisher
option controls which publisher to use, with the default
being index.
hatch publish
{{ cookiecutter.project_slug }}
is distributed under the terms of the
MIT license.