Repository navigation
Tags
Tags
feat(pypi): add py.typed files to pyi_srcs (bazel-contrib#4202) Wheel libraries automatically include all their .pyi files in `pyi_srcs`, but py.typed files are just as important. In this patch we begin including them and make the same change to the runfiles py_library as well. (cherry picked from commit 28fe2e8) Work towards bazel-contrib#4175
feat(toolchains): update CPython 3.15.0 from rc1 to rc2 (bazel-contri… …b#4199) Make CPython 3.15.0rc2 available from the 20260929 python-build-standalone release. Replace the 3.15.0rc1 runtime entries in the manifest with 3.15.0rc2 and update the default 3.15 minor version mapping. (cherry picked from commit 1c026a6) Work towards bazel-contrib#4175
fix(zipapp): reduce bundled interpreter size (bazel-contrib#4165) Bazel reports source symlinks as regular files, causing Python executable aliases to be copied into zipapps as full binaries. Hermetic runtimes also include shared libpython artifacts even when the interpreter links Python statically. Preserve source symlinks through sandbox indirection and exclude libpython shared objects from runtime files while retaining them for explicit native dependencies. Add regression coverage for archive structure and native extension loading. Fixes bazel-contrib#3534 Fixes bazel-contrib#4163 --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Richard Levasseur <richardlev@gmail.com> (cherry picked from commit fd22cff) Work towards bazel-contrib#4175
build(release): exclude devguide.md from version marker checks (bazel… …-contrib#4185) `docs/devguide.md` documents how to use `VERSION_NEXT_*` markers, which causes the release workflow version marker check to fail on release branches. Exclude `devguide.md` from the version marker check script and the release tool replacement patterns. Work towards bazel-contrib#4175
docs(changelog): add 2.3.4 entry for win32 Python runtimes PR bazel-contrib#4156 merged the win32 Python runtime additions directly to the release/2.3 branch without a changelog update. Add the 2.3.4 release section to CHANGELOG.md so the upcoming patch release documents the new toolchains. Work towards bazel-contrib#4173
fix(gazelle): fix module map for old-style namespaces (bazel-contrib#… …4135) The performance tweak in bazel-contrib#3415 which parallelized gazelle module map generation calls simplify() on wheels individually, which always results in entries which collapse to the highest level modules which contain __init__.py files. But when two wheels do old-style namespace packages by both including that file under their top-level module, they simplify down to the top-level module, clobber each other when merged, and wind up with one wheel getting mapped for the entire namespace. This causes bug bazel-contrib#3528. We fix this by deferring our call to simplify() until after we've merged all the wheels' module info. Fixes bazel-contrib#3528 (cherry picked from commit a6606a5) Work towards bazel-contrib#4121
chore: cherry-picks for 2.3.2 (bazel-contrib#4089) Cherry-picks: - bazel-contrib#4044 - bazel-contrib#4054 - bazel-contrib#4086 - bazel-contrib#4083 Extra fixes (PR to main in bazel-contrib#4090): - doc: changelog entries for 2.3.2 - chore: fix version numbers Work towards bazel-contrib#4088 --------- Co-authored-by: Richard Levasseur <richardlev@gmail.com> Co-authored-by: Kristian Hartikainen <kristian@ekarobotics.com> Co-authored-by: Henrique <121921605+henriquejsza@users.noreply.github.com>
fix(pypi): do not return rctx.metadata for pip_archive (bazel-contrib… …#4043) There was a small regression in bazel-contrib#3948 that may affect experimental repository cache users. Related to bazel-contrib#3791 (cherry picked from commit 6302a3d) Work towards bazel-contrib#4049
fix(pypi): resolve self-referencing extras to a real fixed point (baz… …el-contrib#4039) ## Summary `_resolve_extras` decides that its fixed-point loop has converged by comparing `num_extras_before` — the size of the extras set at the *start* of the round — against `len(new_extras)`, the number of extras discovered *during* that round: ```python num_extras_before = len(extras) extras = extras | new_extras num_extras_after = len(new_extras) # the delta, not the merged size if num_extras_before == num_extras_after: break ``` Those are unrelated quantities, and the mismatch breaks in two separate ways. ### 1. Extras are silently dropped The loop exits early whenever the two counts happen to coincide while the set is still growing, so extras reachable only through a further round are never resolved —- and every dependency gated on them silently disappears from the generated target. The smallest reproducer is a two-hop self-extras chain: | `Requires-Dist` | requested | resolved today | expected | |---|---|---|---| | `foo[b]; extra == 'all'`, `foo[c]; extra == 'b'` | `foo[all]` | `{all, b}` | `{all, b, c}` | Anything behind `extra == 'c'` is lost, with no error. This is not limited to the first round: a chain that branches before it deepens (`all → {p, q}`, `p → r`, `r → t`) hits the same equality on round two and drops `t`. ### 2. The loop never terminates early for ordinary packages For a package with no self-referencing extras — the overwhelmingly common case — `self_reqs` is empty, so `new_extras` is always `{}` while `extras` holds at least one entry. The condition can never hold, and the loop runs all 10000 rounds, allocating a dict each time, while evaluating the generated `BUILD` file of every wheel in the build. On a ~52k-package repository this dominated loading-phase Starlark CPU: | Metric | Before | After | |---|---|---| | `_resolve_extras` self-time | 430–442 CPU-s | below profiler threshold | | Total Starlark user-function CPU | 747–759 CPU-s | 275–298 CPU-s | | Cold loading+analysis wall time (16 cores) | 82–84 s | 73–75 s | ## The fix Compare the size of the *merged* set, which is what the `before`/`after` naming already implied. The loop is monotonic, so the converged set is unchanged wherever it previously terminated correctly — this only stops it terminating too early, or not at all. ## Tests Three regression tests are added to `tests/pypi/pep508/deps_tests.bzl`, covering the three shapes that trigger the early exit: a two-hop chain, multiple requested extras, and a chain where the counts only coincide after the first round. All three fail on `main` with exactly the dropped dependency, and pass with the fix: ``` //tests/pypi/pep508:test_self_extras_chain_is_fully_resolved FAILED 1 missing: c_dep //tests/pypi/pep508:test_self_extras_chain_with_multiple_requested_extras FAILED 1 missing: c_dep //tests/pypi/pep508:test_self_extras_chain_resolved_beyond_the_first_round FAILED 1 missing: t_dep ``` The three existing tests that exercise self-extras chains (`test_self_is_ignored`, `test_self_dependencies_can_come_in_any_order`, `test_self_include_deps_from_previously_visited`) pass either way, which is why this went unnoticed. `bazel test //tests/pypi/...` is green (249/249) with the fix applied. ## Notes The condition was introduced in bazel-contrib#3527, which replaced the previous double loop with this fixed-point loop. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 9361a1a) Work towards bazel-contrib#4010
fix(pypi): resolve self-referencing extras to a real fixed point (baz… …el-contrib#4039) ## Summary `_resolve_extras` decides that its fixed-point loop has converged by comparing `num_extras_before` — the size of the extras set at the *start* of the round — against `len(new_extras)`, the number of extras discovered *during* that round: ```python num_extras_before = len(extras) extras = extras | new_extras num_extras_after = len(new_extras) # the delta, not the merged size if num_extras_before == num_extras_after: break ``` Those are unrelated quantities, and the mismatch breaks in two separate ways. ### 1. Extras are silently dropped The loop exits early whenever the two counts happen to coincide while the set is still growing, so extras reachable only through a further round are never resolved —- and every dependency gated on them silently disappears from the generated target. The smallest reproducer is a two-hop self-extras chain: | `Requires-Dist` | requested | resolved today | expected | |---|---|---|---| | `foo[b]; extra == 'all'`, `foo[c]; extra == 'b'` | `foo[all]` | `{all, b}` | `{all, b, c}` | Anything behind `extra == 'c'` is lost, with no error. This is not limited to the first round: a chain that branches before it deepens (`all → {p, q}`, `p → r`, `r → t`) hits the same equality on round two and drops `t`. ### 2. The loop never terminates early for ordinary packages For a package with no self-referencing extras — the overwhelmingly common case — `self_reqs` is empty, so `new_extras` is always `{}` while `extras` holds at least one entry. The condition can never hold, and the loop runs all 10000 rounds, allocating a dict each time, while evaluating the generated `BUILD` file of every wheel in the build. On a ~52k-package repository this dominated loading-phase Starlark CPU: | Metric | Before | After | |---|---|---| | `_resolve_extras` self-time | 430–442 CPU-s | below profiler threshold | | Total Starlark user-function CPU | 747–759 CPU-s | 275–298 CPU-s | | Cold loading+analysis wall time (16 cores) | 82–84 s | 73–75 s | ## The fix Compare the size of the *merged* set, which is what the `before`/`after` naming already implied. The loop is monotonic, so the converged set is unchanged wherever it previously terminated correctly — this only stops it terminating too early, or not at all. ## Tests Three regression tests are added to `tests/pypi/pep508/deps_tests.bzl`, covering the three shapes that trigger the early exit: a two-hop chain, multiple requested extras, and a chain where the counts only coincide after the first round. All three fail on `main` with exactly the dropped dependency, and pass with the fix: ``` //tests/pypi/pep508:test_self_extras_chain_is_fully_resolved FAILED 1 missing: c_dep //tests/pypi/pep508:test_self_extras_chain_with_multiple_requested_extras FAILED 1 missing: c_dep //tests/pypi/pep508:test_self_extras_chain_resolved_beyond_the_first_round FAILED 1 missing: t_dep ``` The three existing tests that exercise self-extras chains (`test_self_is_ignored`, `test_self_dependencies_can_come_in_any_order`, `test_self_include_deps_from_previously_visited`) pass either way, which is why this went unnoticed. `bazel test //tests/pypi/...` is green (249/249) with the fix applied. ## Notes The condition was introduced in bazel-contrib#3527, which replaced the previous double loop with this fixed-point loop. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 9361a1a) Work towards bazel-contrib#4010
PreviousNext