Skip to content
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

Merged
merged 10 commits into from
Feb 15, 2024

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented Feb 14, 2024

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:

  • 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 and simplify tests.
  • allow to specify arbitrary repos and config settings
    when generating aliases, which is useful in multi-platform hub
    generation.

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).
@aignas aignas marked this pull request as ready for review February 14, 2024 05:32
repo_name = rctx.attr.repo_name,
rules_python = rctx.attr._template.workspace_name,
aliases = {
key: [whl_alias(**v) for v in json.decode(values)]
Copy link
Contributor

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...

Copy link
Collaborator Author

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.

python/private/bzlmod/pip.bzl Show resolved Hide resolved
@aignas aignas added this pull request to the merge queue Feb 15, 2024
Merged via the queue into bazelbuild:main with commit c0c6901 Feb 15, 2024
4 checks passed
@aignas aignas deleted the refactor/render-pkg-aliases branch February 15, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants