Repository navigation
refactor(pypi): parse the requirements with pypackaging.bzl #4561
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
Draft
+104
−57
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9ea3efe
refactor: normalize the names with pypackaging.bzl
aignas 0c44a82
refactor(pypi): parse the requirements with pypackaging.bzl
aignas d6ce4ba
revert: keep normalize_name free of pypackaging.bzl
aignas c15b709
fix(pypi): accept tabs before the options and markers right after the…
aignas b90e56f
refactor(pypi): cache parsed requirements across files and polish docs
rickeylev d30d0f2
fix(pypi): only strip the options outside of the quoted strings of th…
aignas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| (pypi) Invalid PEP 508 requirements now fail instead of being silently accepted, | ||
| as requirements are now parsed by | ||
| [`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl) (a Starlark | ||
| port of [`packaging`](https://github.com/pypa/packaging)). `WORKSPACE` users | ||
| get `pypackaging.bzl` from {obj}`py_repositories`. |
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
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
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
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
Oops, something went wrong.
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.
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.
Limit quote tracking in
_strip_optionsto marker text.Apostrophes are valid URL path characters. RFC 3986 lists
'as a sub-delimiter, and sub-delimiters are allowed in path segments (RFC 3986). Inpython/private/pypi/pep508_requirement.bzl:75-77, the apostrophe init'sopens a quote. The loop never finds a closing quote, so it does not check--config-settingsfor an option separator and returns the full line.pypackaging.requirements.parsethen ends the URL at the space. It fails at-, because only;or the end of the string may follow the URL. As a result,foo @ https://example.org/it's/foo-1.0.tar.gz --config-settings=key=valueraises a syntax error.Track quotes only after the
;marker separator. Keep the quoted-string skip for markers, so option-like text inside marker strings, such asfoo; sys_platform == "a -b", is not stripped. Add a test with an apostrophe in a direct URL and a trailing option beside the quoted-marker tests.