refactor(pypi): implement PEP508 compliant marker evaluation #2692
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.
This implements the PEP508 compliant marker evaluation in starlark and
removes the need for the Python interpreter when evaluating requirements
files passed to
pip.parse
. This makes the evaluation faster and allowsus to fix a few known issues (#2690).
In the future the intent is to move the
METADATA
parsing to purestarlark so that the
RequiresDist
could be parsed in starlark at themacro evaluation or analysis phases. This should make it possible to
more easily solve the design problem that more and more things need to
be passed to
whl_library
as args to have a robust dependency parsing:compatible
METADATA
parsing and passing it toPython
and back makesit difficult/annoying to implement.
METADATA
file requires the precise list of targetplatform or the list of available packages in the
requirements.txt
.This means that without it we cannot trim the dependency tree in the
whl_library
. Doing this at macro loading phase allows us to dependon
.bzl
files in thehub_repository
and more effectively passinformation.
I can remotely see that this could become useful in
py_wheel
or an buildingwheels from sdists as the environment markers may be present in various source
metadata as well. What is more
uv.lock
file has the env markers as part ofthe lock file information, so this might be useful there.
Work towards #2423
Work towards #260
Split from #2629