-
Notifications
You must be signed in to change notification settings - Fork 542
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
fix: redirect entrypoints to py_console_script_binary #2063
base: main
Are you sure you want to change the base?
Changes from all commits
917f4aa
9a284f0
11c7d77
93ea396
140aff1
b790cb7
2d5b718
a60fe3e
16ad519
68c6379
eff6d4d
17f8768
bcd653e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,14 @@ | |
# limitations under the License. | ||
|
||
""" | ||
Creates an executable (a non-test binary) for console_script entry points. | ||
|
||
```{include} /_includes/py_console_script_binary.md | ||
``` | ||
Please use `py_console_script_binary` from `//python:pip_bzl` instead. | ||
""" | ||
|
||
load("//python/private:py_console_script_binary.bzl", _py_console_script_binary = "py_console_script_binary") | ||
load("//python:pip.bzl", _py_console_script_binary = "py_console_script_binary") | ||
|
||
def _compatibility_shim(**kwargs): | ||
# buildifier: disable=print | ||
print("Please use `py_console_script_binary` from `//python:pip_bzl` instead.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw people using deprecation attribute in some cases instead of a print (this is in py_proto_library case). That may be less spammy, as this will cause one print invocation per usage of the rule, I think? Maybe it would be useful to print a buildozer command for replacing the loads? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM. Didn't know about it. Will FIXUP. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For macros, I think there's a doc string syntax that stardoc parses out into a "deprecation" doc text. I think it's either I'm pretty sure our docgen respects it when stardoc emits it. |
||
_py_console_script_binary(**kwargs) | ||
|
||
py_console_script_binary = _py_console_script_binary | ||
py_console_script_binary = _compatibility_shim |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ | |
# limitations under the License. | ||
|
||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | ||
load("@rules_python//python:defs.bzl", "py_library") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please drop rules_python in the load statements in internal code. |
||
load("//python:py_binary.bzl", "py_binary") | ||
load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") | ||
|
||
package(default_visibility = ["//:__subpackages__"]) | ||
|
@@ -227,6 +229,17 @@ bzl_library( | |
srcs = ["pip_repository_attrs.bzl"], | ||
) | ||
|
||
bzl_library( | ||
name = "py_console_script_binary_bzl", | ||
srcs = [ | ||
":py_console_script_binary.bzl", | ||
":py_console_script_gen.bzl", | ||
], | ||
deps = [ | ||
"//python:defs_bzl", | ||
], | ||
) | ||
|
||
bzl_library( | ||
name = "render_pkg_aliases_bzl", | ||
srcs = ["render_pkg_aliases.bzl"], | ||
|
@@ -294,3 +307,22 @@ bzl_library( | |
srcs = ["whl_target_platforms.bzl"], | ||
deps = [":parse_whl_name_bzl"], | ||
) | ||
|
||
# Used for py_console_script_gen rule | ||
py_binary( | ||
name = "py_console_script_gen_py", | ||
srcs = ["py_console_script_gen.py"], | ||
main = "py_console_script_gen.py", | ||
visibility = [ | ||
"//visibility:public", | ||
], | ||
) | ||
|
||
py_library( | ||
name = "py_console_script_gen_lib", | ||
srcs = ["py_console_script_gen.py"], | ||
imports = ["../.."], | ||
visibility = [ | ||
"//tests/pypi/py_console_script:__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.
Nit, I think this should be pip.bzl instead of pip_bzl.
Maybe it would be great to write the full load statement to help users?
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.
SGTM. Will FIXUP.