refactor: read migrated native flags through a centralized accessor function (#3290) This lets Python logic support either Starlark- or native-defined flags, based on Bazel support: - Pre-Bazel 9.0: always use native flags - Bazel 9.0+: use Starlark flags if [incompatible change](https://github.com/bazelbuild/bazel/pull/27056) that disables `ctx.fragments.py` and `ctx.fragments.bazel_py` is set - Include a developer override to trigger Starlark versions while testing Starlarkification. Developers enable this by updating .bzl code in their local workspace. This can be removed as soon as Starlarkification is complete Also check in a Starlark version of `--experimental_python_import_all_repositories` for testing. **This is a no-op. New flag sources of truth don't take effect without a supporting bazel version that sets appropriate incompatible flags.** **Caveats:** - May not work with `configuration_field` as implemented. We can loosen the incompatible flag lockdown if that's an issue. For https://github.com/bazel-contrib/rules_python/issues/3252 TODO list * [ ] Add docs to docs/api/rules_python/python/config_settings/index.md for starlarkified flags
This repository is the home of the core Python rules -- py_library, py_binary, py_test, py_proto_library, and related symbols that provide the basis for Python support in Bazel. It also contains package installation rules for integrating with PyPI and other indices.
Documentation for rules_python is at https://rules-python.readthedocs.io and in the Bazel Build Encyclopedia.
Examples live in the examples directory.
The core rules are stable. Their implementation is subject to Bazel's backward compatibility policy. This repository aims to follow semantic versioning.
The Bazel community maintains this repository. Neither Google nor the Bazel team provides support for the code. However, this repository is part of the test suite used to vet new Bazel releases. See How to contribute page for information on our development workflow.
For detailed documentation, see https://rules-python.readthedocs.io
See Bzlmod support for more details.