strip extras from Python PURLs in DG payload#14462
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Python Dependency Grapher’s PURL generation to drop Python “extras” (e.g., cachecontrol[filecache]) so Dependency Graph receives the base package name (e.g., cachecontrol).
Changes:
- Override Python grapher
purl_name_forto normalize names and strip extras before building PURLs. - Add specs ensuring extras are removed from generated PyPI PURLs.
- Add a spec case confirming
requirements.txtremains a valid relevant dependency file when it contains extras.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/lib/dependabot/python/dependency_grapher.rb | Overrides PURL name generation to use normalized base package names (extras removed). |
| python/spec/dependabot/python/dependency_grapher_spec.rb | Adds regression coverage for extras being stripped from PyPI PURLs and a requirements.txt selection case. |
Nishnha
approved these changes
Mar 16, 2026
Copilot AI
added a commit
that referenced
this pull request
Mar 17, 2026
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>
5 tasks
jakecoffman
added a commit
that referenced
this pull request
Mar 17, 2026
* fix(uv): strip extras from dependency names in PURL generation 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> * test: assert normalized cachecontrol PURL is present in extras test Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
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.
What are you trying to accomplish?
Python can specify dependency extras like
cachecontrol[filecache]==0.14.2wherefilecachespecifies a set of transitive dependencies that are optionally specified.Dependabot carries this extra data in the Dependency name (e.g.
cachecontrol[filecache]) probably so when it bumps it preserves the extras.For submitting this data to Dependency Graph we need to strip it, because the package is just
cachecontrol.Anything you want to highlight for special attention from reviewers?
How will you know you've accomplished your goal?
We'll see correct names show up in Dependency Graph.
Running this in Dependabot CLI shows it's working now. This used to be
coverage[toml]Checklist