馃悰 fix(tox_env): canonicalize names when resolving dependency-group extras - #4061
Open
MohammedAlkindi wants to merge 3 commits into
Open
馃悰 fix(tox_env): canonicalize names when resolving dependency-group extras#4061MohammedAlkindi wants to merge 3 commits into
MohammedAlkindi wants to merge 3 commits into
Conversation
for more information, see https://pre-commit.ci
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.
A
dependency-groupsself-reference fails when the project name or the extra is spelled non-canonically._add_extra_to_depsalready canonicalizes the extra it looks up, butresolve()passesproject.optional-dependencieswith its raw keys, soextra_1never matches the canonicalextra-1. Separatelyunwrap_nested_extrascomparesdependency.name == project_namedirectly, sodemo_pkg[...]does not match a project nameddemo-pkg.Both spellings are legal: PEP 503 says these compare equal after normalization, and
_resolve_dependency_groupa few lines above already canonicalizes group names.On main, with
name = "demo-pkg"andtest = ["demo_pkg[extra1]"]:The self-reference is never unwrapped and reaches pip as an unresolvable requirement. The other spelling,
demo-pkg[extra_1], raisesFail: extra not found.Two tests added, one per spelling, both failing before. Reverting either half of the fix on its own makes exactly its own test fail again, so neither is redundant.
tests/tox_env/is unchanged at 230 pre-existing failures either side with an identical failure set by name; the only delta is these two going green.