| commit | bbec4c29add6e7300b416fd2cd2f9da7d2488606 | [log] [tgz] |
|---|---|---|
| author | Richard Levasseur <rlevasseur@google.com> | Thu Dec 14 06:17:53 2023 -0800 |
| committer | GitHub <noreply@github.com> | Thu Dec 14 14:17:53 2023 +0000 |
| tree | 67674db44e41b778898cdf860c2e639072917ba9 | |
| parent | e7d5c8db6dccbea2c1a8ee731f9a472edee680cf [diff] |
fix(py_runtime): make py_runtime_pair return builtin PyRuntimeInfo under Bazel 6; make python_bootstrap_template public (#1611) This fixes two bugs from https://github.com/bazelbuild/rules_python/pull/1574: * Bazel 6's py_binary rejects the rules_python Starlark implemented PyRuntimeInfo. * python_bootstrap_template.txt isn't public; this prevents py_runtime from being used outside rules_python itself (e.g. in the python toolchain repos) With Bazel 6, the `py_binary` rule performs a type check of the PyRuntimeInfo value it gets from the toolchain to verify it is an instance of the Java-implemented PyRuntimeInfo class. This type check fails when the provider is implemented in rules_python in Starlark. To fix, make the `py_runtime_info` prefer the builtin PyRuntimeInfo provider when running under Bazel 6. The two providers are (currently) the same, so are mostly interchangable. This satisfies the type check that `py_binary` performs. `py_runtime` as an implicit dependency on `//python/private:python_bootstrap_template.txt`, but that target is only visible to rules python itself. This means the py_runtime targets created in the toolchain repos fail. To fix, make the file public. Fixes https://github.com/bazelbuild/rules_python/issues/1610
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.
Currently, the core rules build into the Bazel binary, and the symbols in this repository are simple aliases. However, we are migrating the rules to Starlark and removing them from the Bazel binary. Therefore, the future-proof way to depend on Python rules is via this repository. SeeMigrating from the Bundled Rules below.
The core rules are stable. Their implementation in Bazel is subject to Bazel's backward compatibility policy. Once migrated to rules_python, they may evolve at a different rate, but this repository will still 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.