-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Support requirements without an extension #16889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
305c521 to
e9fd2f5
Compare
44e8062 to
d5dad4e
Compare
e9fd2f5 to
7554291
Compare
CodSpeed Performance ReportMerging #16889 will degrade performances by 28.44%Comparing Summary
Benchmarks breakdown
Footnotes |
| // If it's not a PEP 723 script, assume it's a `requirements.txt` file. | ||
| let requirements_txt = | ||
| RequirementsTxt::parse_str(&content, &path, &*CWD, client_builder, cache) | ||
| .await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should special case the error message, asking the user to specify a format manually, as we defaulted to requirements.txt and that failed.
$ uv pip install -r .editorconfig
error: Couldn't parse requirement in `.editorconfig` at position 102
Caused by: no such comparison operator "=", must be one of ~= == != <= >= < > ===
root = true
^^^^^^
$ uv pip install -r uv.lock
error: Couldn't parse requirement in `uv.lock` at position 0
Caused by: no such comparison operator "=", must be one of ~= == != <= >= < > ===
version = 1
^^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's not a way for them to specify the format though, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the filename only, but currently there's no indication that this fails because we're trying to parse anything that doesn't look like a pylock.toml as requirements.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the hint would just be "We tried to parse this as a requirements.txt because it doesn't have an supported extension"?
For uv.lock, see #16192
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a good hint
This PR un-reverts #16861 by resolving extensionless sources with a different strategy: we return an `Extensionless` variant, then infer the type when we read the file and parse the contents immediately after, thereby avoiding multiple reads.
Duplicate of #16889 since I merged it without realizing it was stacked. Co-authored-by: Charlie Marsh <[email protected]>
Summary
This PR un-reverts #16861 by resolving extensionless sources with a different strategy: we return an
Extensionlessvariant, then infer the type when we read the file and parse the contents immediately after, thereby avoiding multiple reads.