Skip to content

Commit 7616956

Browse files
committed
docs: add pep751 version provider documentation
1 parent df340d2 commit 7616956

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/config/version_provider.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,40 @@ name = "my-package"
9696
version = "0.1.0" # Managed by Commitizen
9797
```
9898

99+
### `pep751`
100+
101+
Manages version in `pyproject.toml` (`project.version`) and updates the project's own entry in [PEP 751](https://peps.python.org/pep-0751/) `pylock.toml` lock files. Only updates `[[packages]]` entries that reference the project as a local directory source (`[packages.directory]`), since those are the only entries safe to edit without invalidating hashes and URLs.
102+
103+
!!! note
104+
`pylock.toml` is a standardized Python lock file format (PEP 751). Unlike `package-lock.json` or `uv.lock`, it has no root-level project version — the project may appear as a `[[packages]]` entry with a `[packages.directory]` source. This provider handles that case automatically. If your project doesn't appear in its own lock file (the common case), it behaves identically to `pep621`.
105+
106+
**Use when:**
107+
108+
- You're using a PEP 751-compliant lock tool and have `pylock.toml` files
109+
- You want version synchronization between `pyproject.toml` and `pylock.toml`
110+
111+
**Configuration:**
112+
```toml
113+
[tool.commitizen]
114+
version_provider = "pep751"
115+
```
116+
117+
**Example `pylock.toml` entry that gets updated:**
118+
```toml
119+
lock-version = "1.0"
120+
created-by = "uv"
121+
122+
[[packages]]
123+
name = "my-package"
124+
version = "0.1.0" # Updated by Commitizen
125+
126+
[packages.directory]
127+
path = "."
128+
editable = true
129+
```
130+
131+
Also handles named lock files like `pylock.dev.toml`, `pylock.prod.toml`, etc.
132+
99133
### `uv`
100134

101135
Manages version in both `pyproject.toml` (`project.version`) and `uv.lock` (`package.version` for the matching package name). This ensures consistency between your project metadata and lock file.
@@ -190,6 +224,7 @@ version_provider = "composer"
190224
| `commitizen` | Commitizen config file | No | General use, flexible projects |
191225
| `scm` | None (reads from Git tags) | Yes | `setuptools-scm` users |
192226
| `pep621` | `pyproject.toml` (`project.version`) | No | Modern Python (PEP 621) |
227+
| `pep751` | `pyproject.toml` + `pylock*.toml` | No | PEP 751 lock file users |
193228
| `poetry` | `pyproject.toml` (`tool.poetry.version`) | No | Poetry projects |
194229
| `uv` | `pyproject.toml` + `uv.lock` | No | uv package manager |
195230
| `cargo` | `Cargo.toml` + `Cargo.lock` | No | Rust/Cargo projects |
@@ -324,6 +359,7 @@ Select a version provider based on your project's characteristics:
324359
325360
- **Python projects**
326361
- **with `uv`**: Use `uv`
362+
- **with PEP 751 lock files (`pylock.toml`)**: Use `pep751`
327363
- **with `pyproject.toml` that follows PEP 621**: Use `pep621`
328364
- **with Poetry**: Use `poetry`
329365
- **setuptools-scm**: Use `scm`

0 commit comments

Comments
 (0)