refactor: stop using some deprecated Starlark APIs#2626
refactor: stop using some deprecated Starlark APIs#2626aignas merged 2 commits intobazel-contrib:mainfrom
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
rickeylev
left a comment
There was a problem hiding this comment.
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.
Does it always make sense to load from the global root module context?
There was a problem hiding this comment.
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! |
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.