-
-
Notifications
You must be signed in to change notification settings - Fork 588
refactor: stop using some deprecated Starlark APIs #2626
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: stop using some deprecated Starlark APIs #2626
Conversation
According to the documentation, Label.workspace_name is deprecated: https://bazel.build/rules/lib/builtins/Label#workspace_name
3fc3d18
to
d536802
Compare
According to the Bazel documentation, this method is deprecated: https://bazel.build/rules/lib/builtins/Label#relative In this specific case there is also no need to use it, as we can simply use .repo_name to obtain the repository's canonical name.
d536802
to
78263dc
Compare
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.
Thanks for the PR!
TIL workspace_name is now deprecated. Do you know when .repo_name
became available?
load("{rules_python}//python/private:text_util.bzl", "render") | ||
load("{rules_python}//python:py_binary.bzl", _py_binary = "py_binary") | ||
load("{rules_python}//python:py_test.bzl", _py_test = "py_test") | ||
load("@@{rules_python}//python:pip.bzl", _compile_pip_requirements = "compile_pip_requirements") |
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.
Does it always make sense to load from the global root module context?
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.
You mean that there are still some other places in this file that use @rules_python
instead of @@{rules_python}
? Well, I thought that looked a bit funky, but wasn't sure whether that was accidental/intentional. Happy to change the code either way.
Bazel 7.0 which is the lowest version that we support does not have I would propose to drop support for anything below 7.0 and merge this. We need a CHANGELOG item clearly stating it. |
Hey @rickeylev @aignas,
It's also backported to 6.5.0: https://bazel.build/versions/6.5.0/rules/lib/Label
I noticed
|
Thanks for the digging and the clarification, it sounds good to me then! |
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.
LGTM as is.
I am currently working on an analysis tool that is capable of parsing BUILD/*.bzl files. It currently fails to process some of the Python rules, due to the rules depending on some features that are deprecated on the Bazel side. Instead of adding implementations of these deprecated features to my brand new analysis tool, I thought I'd simply patch up the Python rules instead.