Use explicit __init__.py files instead of implicit creation - #1082
onnosteenbergen-samotics wants to merge 1 commit into
Conversation
rules_python now warns for every executable target that relies on implicit __init__.py creation (bazel-contrib/rules_python#2945), so depending on rules_pkg prints that warning for build_tar, build_zip, make_deb, and for targets created by pkg_install and verify_archive_test. Add the missing __init__.py files (pkg/private/tar, pkg/private/deb), put every __init__.py in the srcs of a py_library (//pkg:init, //pkg/private:init) that the importing libraries depend on, and set legacy_create_init = 0 on all py_binary and py_test targets under pkg/. The per-target attribute is used rather than the module-wide explicit_init_py setting because the latter requires rules_python 2.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
I've signed the CLA, but the co-author is Claude.ai. Don't know how to solve that one. |
tonyaiuto
left a comment
There was a problem hiding this comment.
Have you tried this without setting legacy_create_init? ISTM that it should still work without that, and be backwards compatible with older python rules
The only author that matters is onnosteenbergen-samotics. |
|
Re-ran the check and it still marks Claude as failed. Will verify if |
The 5 warnings in the "without" run on 2.3.2: The tar, zip and deb outputs had the same sha256 in every run (e.g. demo_tar.tar is 0639fb21…).
|
Fixes #1081.
rules_python warns for executables that rely on implicit
__init__.pycreation (bazel-contrib/rules_python#2945), which shows up for every consumer ofpkg_tar,pkg_zip,pkg_deb,pkg_installandverify_archive_test.pkg/private/{tar,deb}/__init__.pyand put every__init__.pyin thesrcsof apy_library(//pkg:init,//pkg/private:init).legacy_create_init = 0on allpy_binary/py_testtargets underpkg/, including those created by the macros. The per-target attribute is used because the module-wideexplicit_init_pysetting requires rules_python 2.3.//tests:explicit_init_test, which fails if a package is imported as a namespace package.🤖 Generated with Claude Code