Commit 5392da8
fix(providers/uv): treat uv.lock as optional
Closes #1383.
`UvProvider.set_lock_version()` unconditionally read `uv.lock`, which
made `cz bump` crash with `FileNotFoundError` whenever the lock had not
been written yet. The two reproducers in #1383 are:
- a freshly initialised uv project (`uv init`) before `uv sync` has run,
- a uv workspace member where the lock lives at the workspace root, not
alongside the package's own `pyproject.toml`.
Add an `if not self.lock_file.exists(): return` early-out so updating
`pyproject.toml` is enough; the lock is rewritten only when present.
A regression test creates a `pyproject.toml` without a sibling `uv.lock`
and asserts that `set_version` updates the project file and does not
write a lock.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 4d99415 commit 5392da8
2 files changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
0 commit comments