-
Notifications
You must be signed in to change notification settings - Fork 541
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
internal: support repo prefixes and config settings in alias rendering #1756
Conversation
Summary: - introduce a whl_alias struct to make code more object oriented. - make the interface of the function as small as possible. - unify the bzlmod and legacy code paths. - allow to specify arbitrary repo prefixes and config settings when generating aliases (split out from bazelbuild#1744).
tests/pip_hub_repository/render_pkg_aliases/render_pkg_aliases_test.bzl
Outdated
Show resolved
Hide resolved
tests/pip_hub_repository/render_pkg_aliases/render_pkg_aliases_test.bzl
Outdated
Show resolved
Hide resolved
repo_name = rctx.attr.repo_name, | ||
rules_python = rctx.attr._template.workspace_name, | ||
aliases = { | ||
key: [whl_alias(**v) for v in json.decode(values)] |
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.
Out of scope for this PR, but I wonder if passing a file might work better than passing it as strings in regular attributes. The pip hub basically needs to be given all the possible backing repos and targets, right? Which could be rather large. Putting that in a file seems like it'd scale better than the string attributes.
Oh hm...and that sort of sounds like the sort of intermediate file Phil's thing has been circling around...
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.
Interesting, I like the file idea, we could have a label-keyed
dict here. Once I merge this, I can experiment with this idea.
Co-authored-by: Richard Levasseur <richardlev@gmail.com>
This does not change any logic/features in the bzlmod or legacy code, but
just changes the interfaces and how the parameters are passed. The final
result should be the same.
Summary:
whl_alias
struct to make code more object oriented.when generating aliases, which is useful in multi-platform hub
generation.