Skip to content

Commit afe7981

Browse files
authored
chore(py_executable): print warning if build zip is enabled (#3568)
This prints a warning if `--build_python_zip` is enabled. Work towards #3567 #2586
1 parent b8c217e commit afe7981

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ END_UNRELEASED_TEMPLATE
5858

5959
{#v0-0-0-changed}
6060
### Changed
61+
* **DEPRECATED: implicit zipapp support**
62+
* Implicit zipapp output of `py_binary`/`py_test` has been deprecated and
63+
replaced by separate {obj}`py_zipapp_binary` and {obj}`py_zipapp_test`
64+
rules. See
65+
[#3567](https://github.com/bazel-contrib/rules_python/issues/3567)
66+
for a detailed migration guide.
67+
* (toolchains) stop exposing config settings in python toolchain alias repos.
68+
Please consider depending on the flags defined in
69+
`//python/config_setting/...` and the `@platforms` package instead.
6170
* (binaries/tests) The `PYTHONBREAKPOINT` environment variable is automatically inherited
6271
* (binaries/tests) The {obj}`stamp` attribute now transitions the Bazel builtin
6372
{obj}`--stamp` flag.

python/private/py_executable.bzl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,21 @@ def _create_executable(
379379
# When --build_python_zip is enabled, then the zip file becomes
380380
# one of the default outputs.
381381
if build_zip_enabled:
382+
# buildifier: disable=print
383+
print(
384+
"""
385+
======================================================================
386+
WARNING: Target: {}
387+
The `--build_python_zip` flag and implicit zipapp output of `py_binary`
388+
and `py_test` is deprecated and will be removed in a future release.
389+
Switch to `py_zipapp_binary` or `py_zipapp_test`. For migration
390+
instructions and guide, see:
391+
392+
https://github.com/bazel-contrib/rules_python/issues/3567
393+
======================================================================
394+
""".rstrip().format(ctx.label),
395+
)
396+
382397
extra_default_outputs.append(zip_file)
383398

384399
# The logic here is a bit convoluted. Essentially, there are 3 types of

0 commit comments

Comments
 (0)