Treat paths originating as PEP 508 URLs which contain expanded variables as relative#18680
Merged
Treat paths originating as PEP 508 URLs which contain expanded variables as relative#18680
Conversation
zanieb
approved these changes
Mar 23, 2026
8fed99c to
bffcf23
Compare
konstin
pushed a commit
that referenced
this pull request
Mar 24, 2026
…les as relative (#18680) ## Summary Fix a regression caused by and reported in #18176. PEP 508 doesn't actually permit variables to be specified within these URLs but we support this probably due to needing to handle it for requirements files. To avoid a breaking change in a patch release, any `VerbatimUrl` that was parsed as a PEP 508 URL that contained variables that were expanded is always treated as relative. The determination of if a `VerbatimUrl` qualifies has to be done at creation time because otherwise we would incorrectly treat a non PEP 508 URL which contained something which looks like a variable reference as a relative path in cases where this wouldn't be correct. ## Test Plan Existing test coverage covers the non-regressed case, added a test for the regressed case.
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
Fix a regression caused by and reported in #18176.
PEP 508 doesn't actually permit variables to be specified within these URLs but we support this probably due to needing to handle it for requirements files.
To avoid a breaking change in a patch release, any
VerbatimUrlthat was parsed as a PEP 508 URL that contained variables that were expanded is always treated as relative.The determination of if a
VerbatimUrlqualifies has to be done at creation time because otherwise we would incorrectly treat a non PEP 508 URL which contained something which looks like a variable reference as a relative path in cases where this wouldn't be correct.Test Plan
Existing test coverage covers the non-regressed case, added a test for the regressed case.