Skip to content

fix(uv): strip extras from dependency names in PURL generation#14468

Merged
jakecoffman merged 2 commits into
mainfrom
copilot/fix-grapher-in-uv-directory
Mar 17, 2026
Merged

fix(uv): strip extras from dependency names in PURL generation#14468
jakecoffman merged 2 commits into
mainfrom
copilot/fix-grapher-in-uv-directory

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

What are you trying to accomplish?

Port the Python grapher fix (#14462) to the UV ecosystem. Python dependencies can carry extras in their name (e.g. cachecontrol[filecache]), but PURLs must reference the base package only (pkg:pypi/cachecontrol@0.14.2, not pkg:pypi/cachecontrol[filecache]@0.14.2).

Anything you want to highlight for special attention from reviewers?

Mirrors the exact approach used in the Python grapher — overrides purl_name_for to run the dependency name through NameNormaliser.normalise, which strips extras and normalizes casing/separators.

  • Added purl_name_for override to Dependabot::Uv::DependencyGrapher
  • Added require for dependabot/uv/name_normaliser
  • Added spec and fixture covering extras stripping

How will you know you've accomplished your goal?

UV dependency graph submissions will emit clean PURLs without extras brackets, matching the Python grapher behavior.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

Apply the same fix from Python grapher (PR #14462) to the UV ecosystem.
Add purl_name_for override that uses NameNormaliser.normalise to strip
extras like [filecache] from dependency names in PURLs.

Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
@jakecoffman
Copy link
Copy Markdown
Member

Confirmed this works with dependabot graph uv getsentry/sentry

@jakecoffman jakecoffman marked this pull request as ready for review March 17, 2026 12:44
@jakecoffman jakecoffman requested a review from a team as a code owner March 17, 2026 12:44
Copilot AI review requested due to automatic review settings March 17, 2026 12:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ports the Python dependency grapher behavior to the UV ecosystem so generated PyPI PURLs don’t include dependency extras (e.g., cachecontrol[filecache]), aligning Dependency Graph submissions with the PURL spec.

Changes:

  • Override purl_name_for in Dependabot::Uv::DependencyGrapher to normalize names via NameNormaliser (stripping extras).
  • Add a UV dependency grapher spec case and a pyproject.toml fixture that includes an extra-bearing dependency.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
uv/lib/dependabot/uv/dependency_grapher.rb Normalizes dependency names for PURL generation to strip extras.
uv/spec/dependabot/uv/dependency_grapher_spec.rb Adds a test context asserting extras don’t appear in emitted PURL keys.
uv/spec/fixtures/pyproject_files/uv_dependency_grapher_extras.toml New fixture with cachecontrol[filecache] to exercise extras handling.

Comment thread uv/lib/dependabot/uv/dependency_grapher.rb
Comment thread uv/spec/dependabot/uv/dependency_grapher_spec.rb
Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
@jakecoffman jakecoffman merged commit ede8c4a into main Mar 17, 2026
89 checks passed
@jakecoffman jakecoffman deleted the copilot/fix-grapher-in-uv-directory branch March 17, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants