-
Notifications
You must be signed in to change notification settings - Fork 554
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
refactor(pypi): move config setting processing to the macro #2424
Merged
aignas
merged 10 commits into
bazelbuild:main
from
aignas:refactor/use-whl-alias-in-hub
Nov 22, 2024
Merged
refactor(pypi): move config setting processing to the macro #2424
aignas
merged 10 commits into
bazelbuild:main
from
aignas:refactor/use-whl-alias-in-hub
Nov 22, 2024
Conversation
This file contains 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
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.
aignas
force-pushed
the
refactor/use-whl-alias-in-hub
branch
from
November 18, 2024 09:32
ae80da5
to
16cf803
Compare
rickeylev
approved these changes
Nov 18, 2024
I need to revisit the error message wording here. Will do later. |
ewianda
pushed a commit
to ewianda/rules_python
that referenced
this pull request
Nov 22, 2024
…ld#2424) 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. - Adjust how we store the `whl_config_setting` in the PyPI extension and optimize the passing to the `hub_repository`. This is needed for bazelbuild#2319 and bazelbuild#2423. To be in future PRs: * Remove the need to pass `osx_versions`, etc to the `pkg_aliases` macro.
aignas
added a commit
to aignas/rules_python
that referenced
this pull request
Nov 27, 2024
…ms set It seems that during bazelbuild#2424 I broke the rendering of aliases for the cases when the target platform is set. This means that the feature for multiplatform whls when `experimental_index_url` has never worked even though it was advertised. This ensures that the rendering is happening correctly and adds extra missing tests. Whilst at it: - add an extra test for `pip.parse` handling of env markers that I added to ensure that the error is not in the module extension. - Cleanup unused code - error message constant and the repo arg in `whl_config_setting`. Fixes bazelbuild#2446
rickeylev
pushed a commit
that referenced
this pull request
Nov 27, 2024
…ms set (#2447) It seems that during #2424 I broke the rendering of aliases for the cases when the target platform is set. This means that the feature for multiplatform whls when `experimental_index_url` has never worked even though it was advertised. This ensures that the rendering is happening correctly and adds extra missing tests. Whilst at it: - add an extra test for `pip.parse` handling of env markers that I added to ensure that the error is not in the module extension. - Cleanup unused code - error message constant and the repo arg in `whl_config_setting`. Fixes #2446
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.
Before hand we would pass around
whl_alias
struct instances and itwould 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 alot 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:
repo
field fromwhl_alias
.whl_alias
towhl_config_setting
pkg_aliases
tests to usecontains
instead of exactequality to make things less brittle.
pkg_aliases
tests to use different mocks to makeexpectations easier to understand.
whl_config_setting
hashable by using tuples instead of lists.whl_config_setting
in the PyPI extensionand optimize the passing to the
hub_repository
.This is needed for #2319 and #2423.
To be in future PRs:
osx_versions
, etc to thepkg_aliases
macro.