-
-
Notifications
You must be signed in to change notification settings - Fork 597
feat(pip_parse)!: use user friendly aliases to pip repos in requirements arrays #966
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
Conversation
examples/bzlmod/BUILD.bazel
Outdated
@@ -14,7 +14,8 @@ py_library( | |||
name = "lib", | |||
srcs = ["__init__.py"], | |||
deps = [ | |||
requirement("pylint"), | |||
# You can reference libraries using plain text form or the 'requirement' macro | |||
"@pip//:pylint_pkg", |
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.
can it just be @pip//pylint
? That's the nicest syntax users would enjoy most.
(we'd generate a external/pip/pylint/BUILD.bazel
file with appropriate aliases)
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.
I would love to use this and would be willing to implement this if this approach was agreed universally. @rickeylev, any opinions here?
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.
@alexeagle, what do you think about the inclusion of the user friendly aliases?
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.
What if gazelle was changed to use the requirement
function?
That's how it works in Java:
https://github.com/bazelbuild/rules_jvm_external/blob/master/examples/bzlmod/java/src/com/github/rules_jvm_external/examples/bzlmod/BUILD#L7
I am working on a PR that refactors the external package artifact macros. Which would make things a lot simpler for both bzlmod and general maintenance of the rules. The artifact macros in rules_jvm_external work quite differently to the present repository rules in rules_python. The overuse of repository rules in rules_python is a bit of legacy tech-debt which I'm hoping to clean up. |
This changes the label strings that the users would get when loading the `all_requirements` and `all_whl_requirements` from the generated `requirements.bzl`. Previous labels were not really useable under bzlmod, because they would not be visible to the consumer. Work towards bazel-contrib#965
This is related to bazel-contrib#814 as it is bringing user-friendly alias generation and it is doing this in a breaking way for the `bzlmod` users who are not using the `requirement` macro. The labels that they use will change from `@@repo//:{name}_pkg` to `@@repo//{name}`. I am intentionally leaving the requirement macros in the requirements.bzl unchanged as bazel-contrib#989 might change the approach again. Since these aliases can be used by bzlmod and non-bzlmod users, we can then support the same generated `gazelle_python.yaml` for both bzlmod and non-bzlmod users.
1b0fd66
to
bddd80f
Compare
This is getting stale, so I'll close this in favour of something else in the somewhat near future. It was also a breaking change, and we should avoid making them. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently the labels in the
all_requirements
andall_whl_requirements
are not useable, which is needed for gazelle bzlmod support.Issue number: #965
What is the new behavior?
We change the labels to point to the aliases that are present when
bzlmod
is used.Does this PR introduce a breaking change?
Other information