Repository navigation
Parse requirements-style inputs into RequirementsInput - #21787
Merged
Merged
Conversation
woodruffw
had a problem deploying
to
automations
September 17, 2026 18:31 — with
GitHub Actions
Error
woodruffw
had a problem deploying
to
automations
September 17, 2026 19:03 — with
GitHub Actions
Error
woodruffw
had a problem deploying
to
automations
September 17, 2026 19:10 — with
GitHub Actions
Error
Member
Author
uv test inventory changesThis PR changes the tests when compared with the
|
woodruffw
marked this pull request as ready for review
September 17, 2026 21:34
zanieb
reviewed
Sep 17, 2026
zanieb
reviewed
Sep 17, 2026
zanieb
reviewed
Sep 17, 2026
zanieb
reviewed
Sep 17, 2026
zanieb
reviewed
Sep 17, 2026
zanieb
reviewed
Sep 17, 2026
| client_builder: &BaseClientBuilder<'_>, | ||
| cache: &mut SourceCache, | ||
| ) -> Result<Self, RequirementsTxtFileError> { | ||
| let requirements_txt = requirements_txt.into(); |
Member
Author
There was a problem hiding this comment.
My 0.02c is it's idiomatic when the receiver is impl Into<T> since there's no target ambiguity. @MichaReiser can strike me down though 🙂
zanieb
reviewed
Sep 17, 2026
zanieb
reviewed
Sep 17, 2026
zanieb
reviewed
Sep 17, 2026
zanieb
reviewed
Sep 17, 2026
Comment on lines
+1226
to
+1227
| error: Invalid requirements input in `http://[LOCALHOST]/requirements.txt` at position 0: ambiguous user/pass authority in URL (not percent-encoded?): https:***@example.com/requirements.txt | ||
| cause: ambiguous user/pass authority in URL (not percent-encoded?): https:***@example.com/requirements.txt |
Member
There was a problem hiding this comment.
Probably outside this pr, but we're repeating this error clause
Member
Author
There was a problem hiding this comment.
Yeah, I'll do this as a fast-follow.
zanieb
approved these changes
Sep 17, 2026
woodruffw
had a problem deploying
to
automations
September 17, 2026 22:14 — with
GitHub Actions
Error
woodruffw
had a problem deploying
to
automations
September 17, 2026 22:23 — with
GitHub Actions
Error
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
woodruffw
force-pushed
the
ww/req-newtype
branch
from
September 18, 2026 15:48
756a221 to
ff4b540
Compare
This branch was successfully deployed
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
This adds a
RequirementsInputAPI, which enumerates theStdin,LocalandRemotestates discretely. The idea here is to make some of the current CLI behavior more correct by construction -- instead of parsing into aPathBufand then trying to sniff what we really have, we parse into aRequirementsInputinstead.Some things to note:
file://...becomesRequirementsInput::Localinstead ofRemotewith afile:scheme. And-becomes aRequirementsInput::Stdin.--requirements, but also--constraintsand any other flag that previously had local and remote requirements-style syntax.RequirementsInputdown to the parsing layer, meaning that we're now doing a better job of tracking the provenance of our inputs. This will be relevant when I resume uv audit: pylock.toml support #21601.Right now we model-asRequirementsInput::Local, but that seems wrong. We probably want a newRequirementsInput::Stdin.RequirementsInput::Remoteis aDisplaySafeUrl, this also gets us free redaction in a few more places that weren't easy to cover before.This also makes one behavioral change: we now handle remote nested requirements more correctly. Previously we would handle a subset of these incidentally, e.g.:
and then
a.txt:This would correctly fetch
https://example.com/foo/b.txt.However, if
a.txtwas this instead:...we would attempt to load a local requirements file from
/b.txtrather thanhttps://example.com/b.txt. Now that requirements loading is more type-aware, we do the join correctly depending on whether it's a URL or a path.This is super marginal in practice, but now our behavior matches pip's.
Test Plan
Updated the tests, and added new ones.