feat(lint): add uv lockfile linter
Metadata
Current evaluation
Merged changes adding a lint-uv-lockfile make target to validate uv.lock against pyproject.toml. Approved by two reviewers and passed all CI checks.
Suggested action: —
No scores available.
Issue body
This came from this discussion: https://github.com/canonical/snapcraft/pull/5529/files#r2121219994
Adds a `lint-uv-lockfile` make target that checks whether uv.lock is valid with the current pyproject.toml. It does not check whether the packages in that file are up to date.
To test it for yourself:
1. Checkout this branch
2. Change line 40 of pyproject.toml (the pytest dependency) to say `"pytest~=8.3",`
3. run `make lint-uv-lockfile` or just `make lint`
```terminal
$ make lint-uv-lockfile
unset UV_FROZEN
uv lock --check
Resolved 108 packages in 43ms
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
make: *** [common.mk:154: lint-uv-lockfile] Error 2
```
- [x] Have you followed the guidelines for contributing?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint && make test`?
---
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged changes adding a lint-uv-lockfile make target to validate uv.lock against pyproject.toml. Approved by two reviewers and passed all CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a pull request introducing a lint-uv-lockfile make target. This new linting step validates that the uv.lock file matches pyproject.toml, automatically flagging dependency mismatches during the build process. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #399 feat(lint): add uv lockfile linter | starbase | closed | Closed as a duplicate of #396. The PR added a uv lockfile linter, passed all CI checks, and received approval before being closed. | |
| #2545 fix(templates): match 'uv add' order of lint fields in pyproject.toml | charmcraft | merged | Merged a fix updating pyproject.toml field ordering in kubernetes and machine profiles to align with uv add, preventing unnecessary diffs. Approved by two reviewers and merged after CI validation. | |
| #2829 fix(test): add ops>=2.0.0 to uv constraint-dependencies | charmcraft | merged | Added ops>=2.0.0 to uv constraint-dependencies in pyproject.toml and the uv_project test fixture. Incorporated reviewer feedback to constrain pyyaml>=5 and fix formatting. Approved by three reviewers and merged. |