Skip to content

Use uv audit for local deps-audit#34

Merged
tsvikas merged 2 commits into
mainfrom
feat/uv-audit
May 15, 2026
Merged

Use uv audit for local deps-audit#34
tsvikas merged 2 commits into
mainfrom
feat/uv-audit

Conversation

@tsvikas
Copy link
Copy Markdown
Owner

@tsvikas tsvikas commented May 15, 2026

Summary

  • Replace the pip-audit-via-uv run invocation in the deps-audit justfile recipe with uv audit --locked (faster, no extra install step).
  • Bump the minimum uv version to 0.10.12 — first release where uv audit exits non-zero on findings (PR Exit with nonzero on audit findings astral-sh/uv#18512) and appears in CLI help (PR Unhide uv audit astral-sh/uv#18540). Earlier versions can't reliably fail the recipe on vulnerabilities.
  • Updates pyproject.toml, the template's pyproject.toml.jinja, the CI matrix in uv-tests.yml, and the README.

Note: uv audit is still a preview feature and emits an experimental warning. Pass --preview-features audit to silence it if desired.

Test plan

  • uv-tests CI matrix passes on both 0.10.12 and latest.
  • Generated project runs just deps-audit cleanly.

🤖 Generated with Claude Code

tsvikas and others added 2 commits May 15, 2026 15:16
`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>
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tsvikas tsvikas merged commit b98621b into main May 15, 2026
5 checks passed
@tsvikas tsvikas deleted the feat/uv-audit branch May 15, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant