Commitizen
A tool for creating standardized commit messages and automated versioning in your project.
What is it used for here?
!
- standardizing commit messages using the Conventional Commits specification
- automatically bumping project version and generating/updating
CHANGELOG.md
andpyproject.toml
(only updating) - integrating with pre-commit hooks to ensure commit messages follow the defined style
Features
- Interactive CLI for creating conventional commit messages via a wizard.
- Automatic version bump based on commit history (
major
,minor
,patch
). - Generates and updates
CHANGELOG.md
andpyproject.toml
(only updating) automatically.
How to use it?
- In this case, the Makefile does the same as running the commands directly via uv. The Makefile is only needed to shorten commands.
!
How to use it with pre-commit?
To use Commitizen with pre-commit, you need to add a configuration for it in your .pre-commit-config.yaml
file.
!
- To check how to create your own hook, see the Commitizen auto-check tutorial.
Configuration
All configuration for Commitizen in this template is located in pyproject.toml under the [tool.commitizen]
section.
Example workflow
Without pre-commit
- In the sense that the hook will run, but your message will be ignored because it matches the structure
!
- Create a commit using
make commit
(orcz commit
). The interactive CLI will help you compose a valid commit message. - Bump version and generate changelog using
make bump
(orcz bump
). This updates the version inpyproject.toml
and regeneratesCHANGELOG.md
based on your commit history. - Push changes: Push your code and the updated changelog/version to your repository.
With pre-commit
- The pre-commit hook will check the message format.
!
- Create a commit using
git commit -m "feat: add new feature"
. - Bump version and generate changelog using
make bump
(orcz bump
). This updates the version inpyproject.toml
and regeneratesCHANGELOG.md
based on your commit history. - Push changes: Push your code and the updated changelog/version to your repository.
For more details on configuration, see the Commitizen Documentation