Skip to main content

cz-path

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot Documentation Status mypy uv pytest Ruff Downloads Stargazers pre-commit Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.

Installation

pip install cz-path

The package depends on Commitizen, so you get the cz command when you install cz-path.

Usage

Configure Commitizen

Point Commitizen at this plugin by setting name to cz_path in your configuration file (see below). To use this plugin for a single run without changing the config file, pass -n cz_path or --name cz_path to cz.

Create a commit

  1. Use a Git repository. Run cz from the repository root. The plugin opens the Git index in the current directory, so running it elsewhere will not see your project.

  2. Stage your changes with git add. The plugin looks at the staged diff against HEAD to suggest a path prefix. If nothing is staged, Commitizen fails with a message that no staged files were found.

  3. Start Commitizen to write the message and create the commit:

    cz commit
    

    Short form: cz c.

  4. Answer the prompts:

    • Prefix — pick the suggested path prefix (if shown), or project, or (empty) for no prefix.
    • Commit title — the rest of the subject line. The full message is <prefix>: <title>.

Message format

Commits follow <prefix>: <title>, for example module/component: short description of the change. The pattern is a prefix (which may be empty), then a colon and space, then the title.

By default, src/ is stripped from the computed prefix. Set remove_path_prefixes to [] to turn that off, or add other path segments (such as a top-level package name) to strip. You do not need to include a trailing / in each entry.

pyproject.toml

[tool.commitizen]
name = "cz_path"
remove_path_prefixes = ["src", "module_name"]

.cz.json

{
  "commitizen": {
    "name": "cz_path",
    "remove_path_prefixes": ["src", "module_name"]
  }
}

Scenarios

Staged files Path prefix String prefix
src/a.c, src/b.c src src/
src/a1.c, src/a2.c src src/a
a.c, b.c (no option) (no option)

If no prefix is found amongst the staged files, only the choices project and empty will be given.

Release files for cz-path 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cz-path 0.0.7
File Size Uploaded
cz_path-0.0.7.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cz-path 0.0.7
File Interpreter ABI Platform
cz_path-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / cz_path-0.0.7.tar.gz

Download URL cz_path-0.0.7.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0929af7ecab5cd4af65e8656ad031d61259ac2fc027421d1aaffacbcca358464
BLAKE2b-256 checksum
How to use checksums
c24f628329c118c4248b9b45988aa79aef8e41b290b790c546e52ac7e5358d12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.

Transparency log

Release files / cz_path-0.0.7-py3-none-any.whl

Download URL cz_path-0.0.7-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8267528ec7249d9d773b1e0c45c39716635aa7fd34aef892dccbdeff80f7519d
BLAKE2b-256 checksum
How to use checksums
1c5db3b96ecc99f397ff1d3721cb87de101650cf25dd195103f6d33024e6a220
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page