-
Notifications
You must be signed in to change notification settings - Fork 542
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
[pypi] Support python micro version in env marker based dependency evaluation #2319
Comments
This just cleans up the code and moves more logic from the repository_rule (i.e. generation of `BUILD.bazel` files) to loading time (macro evaluation). This makes the unit testing easier and I plan to also move the code that is generating config setting names from filenames to this new macro, but wanted to submit this PR to reduce the review chunks. Summary: - Add a new `pkg_aliases` macro. - Move logic and tests for creating WORKSPACE aliases. - Move logic and tests bzlmod aliases. - Move logic and tests bzlmod aliases with groups. - Add a test for extra alias creation. - Use `whl_alias` in `pypi` extension integration tests. - Improve the serialization of `whl_alias` for passing to the pypi hub repo. Related to #260, #2386, #2337, #2319 - hopefully cleaning the code up will make it easier to address those feature requests later. --------- Co-authored-by: Richard Levasseur <richardlev@gmail.com>
This is something of a known issue and the current design has this limitation described in the issue. To properly solve this I would like to have the following solution:
This is a lot of yak shaving for achieving what is asked in the issue, but I do think that moving the evaluation of the markers to the analysis phase is actually the right thing to do here. Until then, one could possibly patch the piece of code that determines the micro version used in evaluating the specifiers in the |
Before hand we would pass around `whl_alias` struct instances and it would go through rounds of starlark functions which would end up rendered as BUILD.bazel files in the hub repository. This means that every time the output of the said functions would change, the `MODULE.bazel.lock` would also possibly change. Since we now have much better unit testing framework, we start relying on these functions being evaluated at loading phase instead of repo rule phase, which means that we can make the `BUILD.bazel` files not change a lot when the underlying code changes, this should make the code more maintainable in the long run and unblocks the code to accept extra things, like env marker values or similar. Summary: - Remove the `repo` field from `whl_alias`. - Rename `whl_alias` to `whl_config_setting` - Move the tests around - Simplify the `pkg_aliases` tests to use `contains` instead of exact equality to make things less brittle. - Simplify the `pkg_aliases` tests to use different mocks to make expectations easier to understand. - Make `whl_config_setting` hashable by using tuples instead of lists. This is definitely needed for bazelbuild#2319 and bazelbuild#2423.
Before hand we would pass around `whl_alias` struct instances and it would go through rounds of starlark functions which would end up rendered as BUILD.bazel files in the hub repository. This means that every time the output of the said functions would change, the `MODULE.bazel.lock` would also possibly change. Since we now have much better unit testing framework, we start relying on these functions being evaluated at loading phase instead of repo rule phase, which means that we can make the `BUILD.bazel` files not change a lot when the underlying code changes, this should make the code more maintainable in the long run and unblocks the code to accept extra things, like env marker values or similar. Summary: - Remove the `repo` field from `whl_alias`. - Rename `whl_alias` to `whl_config_setting` - Move the tests around - Simplify the `pkg_aliases` tests to use `contains` instead of exact equality to make things less brittle. - Simplify the `pkg_aliases` tests to use different mocks to make expectations easier to understand. - Make `whl_config_setting` hashable by using tuples instead of lists. This is definitely needed for bazelbuild#2319 and bazelbuild#2423.
🚀 feature request
Relevant Rules
The
whl_installer
Python program needs to be updated.Description
whl_installer should be aware of the selected full Python version (..) when resiolving dependencies.
Today, it is only aware of the minor version.
See the Redis 5.1.1 wheel. In the METADATA file it has
Requires-Dist: async-timeout>=4.0.3; python_full_version < "3.11.3"
.If the Python runtime is set to 3.11.10, the async-timeout dependency should be excluded, but it isn't. The repo BUILD file looks like this:
Describe the solution you'd like
The text was updated successfully, but these errors were encountered: