# cz-path
[](https://www.python.org/)
[](https://pypi.org/project/cz-path/)
[](https://github.com/Tatsh/cz-path/tags)
[](https://github.com/Tatsh/cz-path/blob/master/LICENSE.txt)
[](https://github.com/Tatsh/cz-path/compare/v0.0.1...master)
[](https://github.com/Tatsh/cz-path/actions/workflows/codeql.yml)
[](https://github.com/Tatsh/cz-path/actions/workflows/qa.yml)
[](https://github.com/Tatsh/cz-path/actions/workflows/tests.yml)
[](https://coveralls.io/github/Tatsh/cz-path?branch=master)
[](https://cz-path.readthedocs.org/?badge=latest)
[](https://github.com/pre-commit/pre-commit)
[](http://mypy-lang.org/)
[](https://github.com/astral-sh/ruff)
[](https://pepy.tech/project/cz-path)
[](https://github.com/Tatsh/cz-path/stargazers)
[](https://bsky.app/profile/Tatsh.bsky.social)
[](https://hostux.social/@Tatsh)
Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.
## Installation
### Poetry
Example with `dev` group:
```shell
poetry add -G dev cz-path
```
### Pip
```shell
pip install cz-path
```
## Usage
Pass `-n cz_path` to `cz` or add it to your configuration file.
By default, `src/` will be removed from any determined prefix. This can be customised by setting
`remove_path_prefixes` to `[]`. You also may want to add other locations such as a module name.
Adding `/` is not required.
### `pyproject.toml`
```toml
[tool.commitizen]
name = "cz_path"
remove_path_prefixes = ["src", "module_name"]
```
### `.cz.json`
```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.
Raw data
{
"_id": null,
"home_page": "https://tatsh.github.io/cz-path/",
"name": "cz-path",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.10",
"maintainer_email": null,
"keywords": "commitizen, commit messages, git, version control",
"author": "Andrew Udvare",
"author_email": "audvare@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5f/7e/fe0e7e0d0f6a79b7a45dd8e321c1ba7989ec89e196f2bdf146ae7683c97e/cz_path-0.0.1.tar.gz",
"platform": null,
"description": "# cz-path\n\n[](https://www.python.org/)\n[](https://pypi.org/project/cz-path/)\n[](https://github.com/Tatsh/cz-path/tags)\n[](https://github.com/Tatsh/cz-path/blob/master/LICENSE.txt)\n[](https://github.com/Tatsh/cz-path/compare/v0.0.1...master)\n[](https://github.com/Tatsh/cz-path/actions/workflows/codeql.yml)\n[](https://github.com/Tatsh/cz-path/actions/workflows/qa.yml)\n[](https://github.com/Tatsh/cz-path/actions/workflows/tests.yml)\n[](https://coveralls.io/github/Tatsh/cz-path?branch=master)\n[](https://cz-path.readthedocs.org/?badge=latest)\n[](https://github.com/pre-commit/pre-commit)\n[](http://mypy-lang.org/)\n[](https://github.com/astral-sh/ruff)\n[](https://pepy.tech/project/cz-path)\n[](https://github.com/Tatsh/cz-path/stargazers)\n\n[](https://bsky.app/profile/Tatsh.bsky.social)\n[](https://hostux.social/@Tatsh)\n\nCommitizen plugin that prefixes commit messages with the common path or prefix of staged files.\n\n## Installation\n\n### Poetry\n\nExample with `dev` group:\n\n```shell\npoetry add -G dev cz-path\n```\n\n### Pip\n\n```shell\npip install cz-path\n```\n\n## Usage\n\nPass `-n cz_path` to `cz` or add it to your configuration file.\n\nBy default, `src/` will be removed from any determined prefix. This can be customised by setting\n`remove_path_prefixes` to `[]`. You also may want to add other locations such as a module name.\nAdding `/` is not required.\n\n### `pyproject.toml`\n\n```toml\n[tool.commitizen]\nname = \"cz_path\"\nremove_path_prefixes = [\"src\", \"module_name\"]\n```\n\n### `.cz.json`\n\n```json\n{\n \"commitizen\": {\n \"name\": \"cz_path\",\n \"remove_path_prefixes\": [\"src\", \"module_name\"]\n }\n}\n```\n\n### Scenarios\n\n| Staged files | Path prefix | String prefix |\n| ---------------------- | ----------- | ------------- |\n| `src/a.c`, `src/b.c` | `src` | `src/` |\n| `src/a1.c`, `src/a2.c` | `src` | `src/a` |\n| `a.c`, `b.c` | (no option) | (no option) |\n\nIf no prefix is found amongst the staged files, only the choices `project` and empty will be given.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.",
"version": "0.0.1",
"project_urls": {
"Documentation": "https://cz-path.readthedocs.org",
"Homepage": "https://tatsh.github.io/cz-path/",
"Issues": "https://github.com/Tatsh/cz-path/issues",
"Repository": "https://github.com/Tatsh/cz-path"
},
"split_keywords": [
"commitizen",
" commit messages",
" git",
" version control"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "38b4a336480bad9569a0164eafccf3f524ad551362b29ef4997caee6180a7802",
"md5": "f7311dc4cc9a107dba90b155592e1290",
"sha256": "a77f1d67917339f87ba396c036a3524d8493a0717b8c573c98b19ad7b69c98d5"
},
"downloads": -1,
"filename": "cz_path-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f7311dc4cc9a107dba90b155592e1290",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.10",
"size": 5322,
"upload_time": "2025-07-14T02:01:19",
"upload_time_iso_8601": "2025-07-14T02:01:19.514018Z",
"url": "https://files.pythonhosted.org/packages/38/b4/a336480bad9569a0164eafccf3f524ad551362b29ef4997caee6180a7802/cz_path-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5f7efe0e7e0d0f6a79b7a45dd8e321c1ba7989ec89e196f2bdf146ae7683c97e",
"md5": "0f6a6239c1059ab6993b67b004a7359c",
"sha256": "cdb442b66fe2d846a81062393bd94f502a1529ffa397f5b59d6076b10d08657d"
},
"downloads": -1,
"filename": "cz_path-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "0f6a6239c1059ab6993b67b004a7359c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.10",
"size": 6330,
"upload_time": "2025-07-14T02:01:20",
"upload_time_iso_8601": "2025-07-14T02:01:20.562169Z",
"url": "https://files.pythonhosted.org/packages/5f/7e/fe0e7e0d0f6a79b7a45dd8e321c1ba7989ec89e196f2bdf146ae7683c97e/cz_path-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 02:01:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Tatsh",
"github_project": "cz-path",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cz-path"
}