feat(pypi): pip.defaults API for customizing pipstar 1/n#2987
Merged
aignas merged 8 commits intobazel-contrib:mainfrom Jun 19, 2025
Merged
feat(pypi): pip.defaults API for customizing pipstar 1/n#2987aignas merged 8 commits intobazel-contrib:mainfrom
aignas merged 8 commits intobazel-contrib:mainfrom
Conversation
Summary: - Allow switching to the Starlark implementation of the marker evaluation function. - Add a way for users to modify the `env` for the marker evaluation when parsing the requirements. This can only be done by `rules_python` or the root module. - Limit the platform selection when parsing the requirements files. Work towards bazel-contrib#2747 Work towards bazel-contrib#2949 Split out from bazel-contrib#2909
14c0ff9 to
cd4dd15
Compare
rickeylev
approved these changes
Jun 18, 2025
| if not env: | ||
| fail("Please define platform: '{}'".format(platform_str)) | ||
|
|
||
| if evaluate(req.marker, env = env): |
Collaborator
There was a problem hiding this comment.
We evaluate during the bzlmod phase to basically pre-filter, right?
e.g if you have {"linux": "requirements_universal.txt"}, then we're basically stripping out all the foo; os=="windows" lines so that we don't bother traversing (in the index) anything for foo for linux, and also avoid generating any targets for foo (for linux, anyways)
Co-authored-by: Richard Levasseur <richardlev@gmail.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 20, 2025
WIP: stacked on #2987 This is adding `constraint_values` attribute to `pip.configure` and is threading it all the way down to the generation of `BUILD.bazel` file of for config settings used in the hub repository. Out of scope: - Passing `flag_values` or target settings. I am torn about it - doing it in this PR would flesh out the design more, but at the same time it might become harder to review. - `whl_target_platforms` and `select_whls` is still unchanged, not sure if it is related to this attribute addition. Work towards #2747 Work towards #2548 Work towards #260 --------- Co-authored-by: Richard Levasseur <richardlev@gmail.com>
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.
Parse env markers in pip.parse using starlark
Summary:
evaluation function.
envfor the marker evaluation whenparsing the requirements. This can only be done by
rules_pythonorthe root module.
Work towards #2747
Work towards #2949
Split out from #2909