| commit | 41f91e96e5804e5fbe5fa83de965cd64219a8f28 | [log] [tgz] |
|---|---|---|
| author | Richard Levasseur <richardlev@gmail.com> | Wed Dec 10 08:36:51 2025 -0800 |
| committer | GitHub <noreply@github.com> | Wed Dec 10 16:36:51 2025 +0000 |
| tree | ac20ee5d15bacea37e915522f202ee09c75a13f2 | |
| parent | 89c8f204daeb588bfb34e142555b2a322a3a7126 [diff] |
refactor: avoid conflict merging when shared libraries are present (#3448) Today, when a shared library is present, an extra VenvSymlinkEntry is generated so that it is linked directly. Unfortunately, this will always have a path overlap conflict with the rest of the venv symlinks, which triggers the conflict merge logic later in py_executable. That logic is expensive, as it must flatten all the files and then link each file individually (essentially doubling the number of files materialized). For large packages like torch (10k+ files), this can dramatically increase overhead. To fix, generate VenvSymlinkEntries that don't overlap. The basic logic for how this works is to identify paths that *must* be directly linked, marking all their parent directories as not being able to be directly linked, and then grouping what remains into the highest directly-linkable path. Along the way, drop the logic that only considers code files and special cases `__init__.py` files and implicit packages. This is simplify the code and more correctly map the extracted wheel into the venv.
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.