Skip to content

bazel: upgrade rules_python to 2.3.2 and enforce explicit init py - #11266

Open
openroad-ci wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:bazel/upgrade-rules-python-2-3-2
Open

bazel: upgrade rules_python to 2.3.2 and enforce explicit init py#11266
openroad-ci wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:bazel/upgrade-rules-python-2-3-2

Conversation

@openroad-ci

Copy link
Copy Markdown
Member

Summary

Upgrades @rules_python from 1.8.5 to 2.3.2, removes the previous quiet = True warning suppression, and configures explicit __init__.py generation for Bazel 9 hermeticity.

Motivation & Background

  1. Fix Upstream Unhashed Pip Warnings & Remove quiet = True:

    • Transitive pip dependencies (such as those from @grpc) previously triggered repetitive warnings (WARNING: requirement file has been generated without hashes...) during bzlmod evaluation. This was previously silenced via quiet = True in PR bazel: silence pip warnings #11143 (f166b4132a).
    • Upstream lockfile hash pinning (initiated in grpc/grpc#42415 and merged in grpc/grpc#42637) combined with rules_python 2.x completely eliminates these unhashed warnings at the source.
    • We can now safely drop quiet = True from pip.parse.
  2. Explicit __init__.py Creation:

    • Rules Python 2.x deprecates implicit __init__.py creation.
    • Configured rules_python_config.explicit_init_py(default = True) in MODULE.bazel and --incompatible_default_to_explicit_init_py in .bazelrc, ensuring zero deprecation noise across both local and transitive external targets (such as sv-lang).
  3. Security & Hermeticity:

    • Enforces SHA-256 hash pinning on all downloaded wheels.
    • Eliminates host python interpreter fallback paths during execution.
  4. Remote Caching:

    • Preserves deterministic action graph inputs and wheel artifacts for remote caching.
  5. Downstream Test Parity:

    • Updated test/downstream/MODULE.bazel to match the rules_python version bump.

Verification

Validated locally using ./etc/bazel-hermetic:

  • //bazel:requirements.test (PASSED)
  • //docs:sphinx_build_test (PASSED)
  • //bazel:tclint (PASSED)
  • //bazel:yamlfix (PASSED)
  • //:openroad_py (PASSED)
  • //test:openroad_public_test (PASSED)
  • //test:openroad_py_public_test (PASSED)
  • //test:openroad_lib_restricted_test (PASSED)
  • //test:rules_verilator_dev_dep_test (PASSED)
  • //docs/src/scripts:test_extract_utils (PASSED)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades rules_python to version 2.3.2 and configures explicit __init__.py behavior using the --incompatible_default_to_explicit_init_py flag and the rules_python config extension. The reviewer suggested also configuring the rules_python config extension in the downstream test workspace to maintain parity and prevent potential build failures.

Comment thread test/downstream/MODULE.bazel
Upgrade rules_python from 1.8.5 to 2.3.2.

Key improvements and rationale:
1. Fix upstream unhashed pip warnings: Upstream lockfile hash-pinning
   (grpc/grpc#42415, resolved via grpc/grpc#42637) combined with rules_python 2.x
   eliminates all transitive 'requirement file has been generated without hashes'
   warnings. We can now safely drop the previous 'quiet = True' suppression.
2. Explicit __init__.py generation: Configured explicit_init_py(default = True)
   and --incompatible_default_to_explicit_init_py in .bazelrc, eliminating
   deprecated implicit __init__.py creation warnings across the workspace
   and external modules.
3. Security & Hermeticity: Deterministic SHA-256 integrity verification across
   all wheels without host Python interpreter fallback paths.
4. Caching: Preserves deterministic action graph hashing for clean remote cache hits.
5. Downstream: Updated test/downstream/MODULE.bazel to maintain parity.

Signed-off-by: Joao Luis Sombrio <sombrio@sombrasoft.dev>
@openroad-ci
openroad-ci force-pushed the bazel/upgrade-rules-python-2-3-2 branch from ae84478 to 16cfaeb Compare August 30, 2026 09:56
@sombraSoft
sombraSoft marked this pull request as ready for review August 30, 2026 09:56
@sombraSoft
sombraSoft requested a review from a team as a code owner August 30, 2026 09:56
@sombraSoft

Copy link
Copy Markdown
Contributor

FYI @oharboe
I have enabled the warnings again just so not to hide warnings if anything upstream breaks in the future.

@sombraSoft

Copy link
Copy Markdown
Contributor

Another small win for our build's hermeticity 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants