Skip to content

Deleting PythonOptions and PythonConfiguration#27900

Closed
dabanki wants to merge 7 commits intobazelbuild:masterfrom
dabanki:remove_py
Closed

Deleting PythonOptions and PythonConfiguration#27900
dabanki wants to merge 7 commits intobazelbuild:masterfrom
dabanki:remove_py

Conversation

@dabanki
Copy link
Contributor

@dabanki dabanki commented Dec 8, 2025

Related to #27842.

This removes hard-coded flags --build_python_zip, --incompatible_default_to_explicit_init_py, --python_native_rules_allowlist, incompatible_python_disallow_native_rules, and incompatible_remove_ctx_py_fragment.

These flags are re-difined in rules_python 1.7.0+ and linked into Bazel in #27792. This PR graveyards them but we can delete them outright when #27793 merges.

By removing --incompatible_remove_ctx_py_fragment, this change removes the ability to revert to native definitions for post-9 Bazel.

For #26521 and bazel-contrib/rules_python#3252.

@dabanki dabanki marked this pull request as draft December 8, 2025 16:49
@github-actions github-actions bot added team-Rules-Python Native rules for Python awaiting-review PR is awaiting review from an assigned reviewer labels Dec 8, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @dabanki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors Bazel's Python build configuration by eliminating the deprecated PythonOptions and PythonConfiguration classes. This change streamlines the Python build system, shifting the management of Python-related flags and logic to the rules_python module and the BazelPythonConfiguration. The legacy flags are preserved as no-op entries in a 'graveyard' to maintain backward compatibility during the transition, while the MODULE.bazel.lock file has been updated to reflect the revised module dependencies. This effort aims to reduce technical debt and improve the modularity of Bazel's Python support.

Highlights

  • Removal of Legacy Python Configuration: The PythonOptions and PythonConfiguration classes, which previously managed Python-related build settings, have been entirely removed from Bazel's core codebase.
  • Deprecation of Python Flags: Several legacy Python-related build flags, such as --build_python_zip and --incompatible_default_to_explicit_init_py, have been moved to BuildGraveyardOptions and marked as deprecated no-op options, signaling their eventual removal.
  • Bazel Module Lock File Update: The MODULE.bazel.lock file has been updated to reflect changes in Bazel module dependencies, including the removal of several module extensions and updates to others, alongside an increment in the lockFileVersion.
  • Cleanup of Python-related Tests and Starlark Definitions: Associated test files and Starlark definitions that relied on the removed Python configuration classes have been deleted or modified to align with the new modular structure.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

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 effectively removes the deprecated PythonOptions and PythonConfiguration classes. The flags previously defined in PythonOptions have been moved to BuildGraveyardOptions as no-op flags, which is a good practice for ensuring backward compatibility for users who may still have these flags in their configurations. All related code, including configuration fragment registrations, build files, and tests, has been consistently updated to reflect these removals. The changes are clean and well-executed. I have no further comments.

@dabanki dabanki force-pushed the remove_py branch 3 times, most recently from a9864b2 to d38008b Compare December 8, 2025 18:41
@dabanki dabanki marked this pull request as ready for review December 8, 2025 18:54
@dabanki dabanki requested a review from gregestren December 8, 2025 18:54
Copy link
Contributor

@gregestren gregestren left a comment

Choose a reason for hiding this comment

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

FYI on the merge conflict mentioned below.

@gregestren gregestren added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Dec 9, 2025
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Dec 12, 2025
@dabanki dabanki deleted the remove_py branch December 18, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Rules-Python Native rules for Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants