commit | 3d68f6cc6b6c906cf5947b384cfba350810cf1fb | [log] [tgz] |
---|---|---|
author | Nikolaus Wittenstein <nikolaus.wittenstein@gmail.com> | Mon Jan 08 16:09:06 2024 -0800 |
committer | GitHub <noreply@github.com> | Tue Jan 09 00:09:06 2024 +0000 |
tree | 39cbeee0cfb0f5dd914a2f4194e609154bc920fd | |
parent | 231d3f633fbcbb36028d96a188298df99bf153e1 [diff] |
fix: Fix per-file config interaction with one py_binary per main (#1664) [This previous PR](https://github.com/bazelbuild/rules_python/pull/1584) added the ability to make a `py_binary` target per file if `if __name__ == "__main__"` tokens were found in the file. This works great in the default case, but when `python_generation_mode` is set to `file`, the plugin now attempts to make both a `py_binary` and a `py_library` target for each main file, which results in an error. This PR modifies the behavior to work properly with per-file target generation, and adds tests for this case.
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.