Use uv audit for local deps-audit#34
Merged
Merged
Conversation
`uv audit` first ships usefully in 0.10.12: PR #18512 made it exit non-zero on findings, and PR #18540 unhid it from CLI help. Earlier versions can't fail the `deps-audit` recipe on vulnerabilities. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The new
deps-auditrecipe drops the--all-extras/--all-groupsbehavior thatpip-audithad; if you want to keep parity with the previous audit scope, consider adding equivalentuv auditoptions once they are available or documenting the narrower coverage explicitly in the recipe comment. - Because
uv auditis still a preview feature and will emit warnings by default, consider adding--preview-features auditdirectly in thedeps-auditrecipe so users get a clean output without having to discover and pass this flag themselves.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `deps-audit` recipe drops the `--all-extras`/`--all-groups` behavior that `pip-audit` had; if you want to keep parity with the previous audit scope, consider adding equivalent `uv audit` options once they are available or documenting the narrower coverage explicitly in the recipe comment.
- Because `uv audit` is still a preview feature and will emit warnings by default, consider adding `--preview-features audit` directly in the `deps-audit` recipe so users get a clean output without having to discover and pass this flag themselves.
## Individual Comments
### Comment 1
<location path="project_name/justfile.jinja" line_range="49" />
<code_context>
- pip-audit \
- --skip-editable
- uv run --exact true
+ uv audit --locked
</code_context>
<issue_to_address>
**issue:** Consider behavior when no lockfile is present for `uv audit --locked`.
`uv audit --locked` will fail if no lockfile exists, whereas `pip-audit` worked directly against the environment. If this is meant to run before a lock is created (or in repos that deliberately avoid locks), consider either (a) guarding and skipping/falling back when no lockfile is present, or (b) explicitly requiring `uv lock` to be run before `deps-audit`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| pip-audit \ | ||
| --skip-editable | ||
| uv run --exact true | ||
| uv audit --locked |
There was a problem hiding this comment.
issue: Consider behavior when no lockfile is present for uv audit --locked.
uv audit --locked will fail if no lockfile exists, whereas pip-audit worked directly against the environment. If this is meant to run before a lock is created (or in repos that deliberately avoid locks), consider either (a) guarding and skipping/falling back when no lockfile is present, or (b) explicitly requiring uv lock to be run before deps-audit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pip-audit-via-uv runinvocation in thedeps-auditjustfile recipe withuv audit --locked(faster, no extra install step).0.10.12— first release whereuv auditexits non-zero on findings (PR Exit with nonzero on audit findings astral-sh/uv#18512) and appears in CLI help (PR Unhideuv auditastral-sh/uv#18540). Earlier versions can't reliably fail the recipe on vulnerabilities.pyproject.toml, the template'spyproject.toml.jinja, the CI matrix inuv-tests.yml, and the README.Note:
uv auditis still a preview feature and emits an experimental warning. Pass--preview-features auditto silence it if desired.Test plan
uv-testsCI matrix passes on both0.10.12andlatest.just deps-auditcleanly.🤖 Generated with Claude Code