Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## master #1979 +/- ##
=======================================
Coverage 98.23% 98.23%
=======================================
Files 61 61
Lines 2779 2780 +1
=======================================
+ Hits 2730 2731 +1
Misses 49 49
☔ View full report in Codecov by Sentry. |
Sorry, something went wrong.
There was a problem hiding this comment.
Fixes cz bump crashing for uv projects when uv.lock is absent by treating the lockfile as optional and adding a regression test for the missing-lock scenario.
Changes:
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| commitizen/providers/uv_provider.py | Skip lock rewrite when uv.lock is not present to avoid FileNotFoundError. |
| tests/providers/test_uv_provider.py | Add regression coverage for projects without a lockfile. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| if not self.lock_file.exists(): | ||
| # `uv.lock` is optional: a freshly initialised project (or a uv | ||
| # workspace member, since the lock lives at the workspace root) | ||
| # may not have one yet. Updating `pyproject.toml` is enough. | ||
| return |
| def set_version(self, version: str) -> None: | ||
| super().set_version(version) | ||
| self.set_lock_version(version) | ||
| # `uv.lock` is optional: a freshly initialised project (or a uv |
There was a problem hiding this comment.
| # `uv.lock` is optional: a freshly initialised project (or a uv | |
| # `uv.lock` is optional: a freshly intialized project (or a uv |
I think we tend to use the US form. but TBH, i don't care as much
Sorry, something went wrong.
Description
Closes #1383.
Why
UvProvider.set_lock_version() unconditionally read uv.lock via self.lock_file.read_text(), so cz bump crashed with FileNotFoundError: [Errno 2] No such file or directory: 'uv.lock' whenever the lock had not been written yet. Two real-world reproducers:
The maintainer (@Lee-W) confirmed in the issue thread: "hmmm... I thought we have it long ago. yep, we'll definitely need it."
What changed
How it works
Backward compatibility
Checklist
Was generative AI tooling used to co-author this PR?
Generated-by: Claude following the guidelines
Code Changes
Expected Behavior
Steps to Test This Pull Request
Additional Context
Surfaced while triaging open issues in #1976 (round 3). Switched from Path.exists() to Path.is_file() in fixup commit f204942e after GitHub Copilot's review noted that the existing convention in cargo_provider.py:42 and npm_provider.py:53,62 is is_file() (and that exists() would still trip if the lock path happened to be a directory). The issue had been open for 11 months and was already labelled good first issue + wait-for-implementation; the previously assigned contributor confirmed they were happy for someone else to take it over.