Skip to content

feat: Rule for C extensions#1

Draft
rsartor-cmd wants to merge 82 commits into
mainfrom
py-extension
Draft

feat: Rule for C extensions#1
rsartor-cmd wants to merge 82 commits into
mainfrom
py-extension

Conversation

@rsartor-cmd

@rsartor-cmd rsartor-cmd commented Jun 23, 2026

Copy link
Copy Markdown
Owner

This PR introduces a new rule, py_extension, used for building C extensions. For now, the macro and rule are sufficiently developed for py_extension_test to build and pass, though work remains to be done for them to be production-ready.

bazel-contrib#3283

jsun-splunk and others added 13 commits June 17, 2026 05:03
…#3795)

Rules that execute a py_runtime interpreter in an action need the
interpreter executable together with its runfiles metadata. The existing
PyRuntimeInfo fields identify the interpreter file and runtime files,
but do not preserve the target's FilesToRunProvider for executable
interpreter targets.

Add PyRuntimeInfo.interpreter_files_to_run for runtimes created from an
executable interpreter target, and validate that direct provider
construction keeps the FilesToRunProvider executable aligned with the
interpreter field. Direct file interpreters and platform runtimes
continue to leave this field unset, preserving existing py_runtime
behavior.

Document the new public provider field and add focused analysis-test
coverage for executable, file-only, platform, and invalid constructor
cases.

One example is
[rules_pycross](https://github.com/jvolkman/rules_pycross) wheel
building with an in-build executable Python runtime. pycross needs to
run the selected Python interpreter in an action, but PyRuntimeInfo
previously exposed only the interpreter File and runtime files, not the
interpreter target's FilesToRunProvider. For executable in-build
runtimes, the FilesToRunProvider is the Bazel-native handle that carries
both the executable and the runfiles metadata needed to stage it as an
action tool. Exposing it lets pycross consume the runtime interpreter
directly for wheel-build actions instead of reconstructing or
approximating the interpreter's runtime closure from separate fields.

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
Update changelog and version markers

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Currently, we update the change log directly when user-visible changes
are made. This works, but makes backporting patches into release
branches prone to unnecessary conflicts. These conflicts can sometimes
be quite confusing, making it easy to accidentally merge incorrect
content.

Instead, what we can do is keep track of an upcoming release's change
log entries in separate files under the `news/` directory. When
creating a release, all the news entries are assembled into a section
in the change log and the news entries deleted. When backporting a
change, after cherry picking, the news entries are merged into the
release's change log section.
…trib#3832)

Under `bazel coverage`, coverage.py raises `NoDataError` from
`lcov_report()`
when no instrumented Python code was executed, instead of writing an
(empty)
report. This error currently propagates out of the coverage bootstrap
and fails
an otherwise passing test.

This is common and benign in a few setups:

- a `py_binary` that only spawns another process and runs no Python
itself
- a test whose instrumented sources happen not to execute any Python

**Before:** `bazel coverage //a:test` fails with
`coverage.exceptions.NoDataError`
even though `bazel test //a:test` passes.

**After:** the `NoDataError` is caught and the empty report is skipped,
so the
test result is unchanged by whether coverage data happened to be
collected.

This mirrors the reporter's suggestion in bazel-contrib#2762 to "ignore the return
code of
`coverage lcov`", applied in-process. As noted on the original report
and in
bazel-contrib#3823, there is no in-repo harness for exercising real coverage
collection, so
this change does not add an automated test.

Fixes bazel-contrib#2762

---------

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
…bazel-contrib#3828)

Resolve `pip.parse(experimental_index_url = ...)` through `envsubst`
before checking whether the experimental index-url code path should be
enabled.

Previously, an unsubstituted template like
`$RULES_PYTHON_PIP_INDEX_URL` is a non-empty string and therefore
truthy, so `_set_get_index_urls` enabled the experimental index-url
mode even when the env var was unset or expanded to empty.

With this change, the value is expanded first (using `pip_attr.envsubst`
and `module_ctx.os.environ.get`) and the truthiness check runs against
the resolved string, matching the behavior users expect when they gate
the index URL on an env var.

---------

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
1. Refactored patch_whl.bzl — Extracted fix_record_content() as a public
   pure function (no rctx dependency) so it can be unit tested directly.

2. Unit tests (patch_whl_tests.bzl) — 5 new rules_testing tests for
fix_record_content:
   - Adds missing files to RECORD
   - Returns None when nothing is missing
   - Preserves quoting style of existing entries
   - Skips excluded files (INSTALLER, RECORD*, REQUESTED)
   - Skips .whl files

3. Integration test (patch_whl_patch_test.py) — End-to-end test that:
- Creates a wheel from testdata/pkg/ via whl_from_dir_repo
- Applies a patch via whl_library(whl_patches=...)
- Verifies pkg.PATCHED is True (was False) and pkg.DATA is unchanged

The integration test follows the established pattern: test data in
tests/pypi/patch_whl/testdata/, registered in internal_dev_deps.bzl,
wired into MODULE.bazel, and built as a py_test. All 205 pypi tests
pass.

With this we can potentially more easily separate whl and sdist path
ways.

---------

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
…APIs (bazel-contrib#3835)

Currently, `VenvSymlinkEntry` and `VenvSymlinkKind` are defined in the
private `python/private/py_info.bzl` file, making them inaccessible to
users who want to programmatically define virtual environment symlinks
when using `PyInfo` (or at the least, having to load private file
paths).

To fix this, we load and re-export both symbols in the public
`python/py_info.bzl` file.

Along the way
* Adds `VenvSymlinkEntryBuilder` to allow fluent construction of symlink
  entries via PyInfoBuilder.
* Adds `features.loadable_symbols` to allow programmatic detection of
  these public symbols.
Currently, the generated changelog has a broken link to the news
directory. Since we can process the files as part of docgen, fix the
broken link by rendering the news as one would see it for a release.

Along the way...
* Delete defunct unreleased template handling, as we've switched to
  news file assembly instead.
Enable bazel-diff to improve CI performance by skipping targets that
aren't affected by a PR
This PR fixes the CI breakage on main where bazel-diff ran in plain
query mode, ignoring target_compatible_with and attempting to run
platform-incompatible tests. It re-introduces the java wrapper to inject
cquery mode targeting only non-manual tests, and re-applies the
visibility fix.
…-contrib#3840)

This PR disables the bazel-diff target filtering to repair the CI. Since
we
make heavy use of target_compatible_with to restrict tests to specific
platforms, and Bazel CI's bazel-diff integration isn't able to handle
those.
Implicit `__init__.py` creation is deprecated and will be disabled by
default in a future release. We need to warn users when their targets
rely on this behavior so they can transition to explicit `__init__.py`
files before the default changes and their builds break.

Work towards bazel-contrib#2945
…template (bazel-contrib#3842)

Align the Windows path resolution in the site initialization template
with the bootstrap template to prevent flaky platform lookup errors on
Windows 2022. This is achieved by wrapping the win32 version retrieval
in a retrying loop.

Fixes bazel-contrib#3721
@rsartor-cmd rsartor-cmd changed the title Py extension feat: Rule for C extensions Jun 23, 2026
gleyba and others added 7 commits June 24, 2026 03:26
Fixes venv output naming for `py_binary` and `py_test` targets whose
names
contain path separators.

Before this change, the venv output prefix was derived from the
executable
basename. Distinct targets such as `//:foo/tool` and `//:bar/tool` both
have
executable basename `tool`, so they could both declare the same
package-relative venv output directory:

```text
bazel-out/.../bin/_tool.venv
```

After this change, the venv output prefix is derived from the full
target name
with `/` replaced by `_`, so those targets use separate venv output
directories
such as:

```text
_foo_tool.venv
_bar_tool.venv
```

Added regression coverage for slash-named executable targets in the
shared
`py_binary` / `py_test` base-rule tests.

Fixes bazel-contrib#3844
This introduces workflows and tools to automate releases. The basic
idea it to have an issue with tasks, and workflows invoke tools that
parse and update the tasks in the issue.

The basic release steps are:
1. Prepare a release (update changelog via PR)
2. Create a release branch after preparation
3. Backport changes into the release branch
4. Tag RCs
5. Promote to final

Each step has a workflow. For now, most of the workflows require a
manual trigger, to help prevent workflows from running wild as we
flush out bugs and edge cases.

The workflows almost entirely delegate to the `release` tool. There's
basically one command per workflow. This makes it easy to encode
specialized logic and run it locally for testing or reproduction.
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to
7.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/checkout/releases">actions/checkout's
releases</a>.</em></p>
<blockquote>
<h2>v7.0.0</h2>
<h2>What's Changed</h2>
<ul>
<li>block checking out fork pr for pull_request_target and workflow_run
by <a href="https://github.com/aiqiaoy"><code>@​aiqiaoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2454">actions/checkout#2454</a></li>
<li>Bump actions/publish-immutable-action from 0.0.3 to 0.0.4 in the
minor-actions-dependencies group across 1 directory by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2458">actions/checkout#2458</a></li>
<li>Bump flatted from 3.3.1 to 3.4.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2460">actions/checkout#2460</a></li>
<li>Bump js-yaml from 4.1.0 to 4.2.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2461">actions/checkout#2461</a></li>
<li>Bump <code>@​actions/core</code> and
<code>@​actions/tool-cache</code> and Remove uuid by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2459">actions/checkout#2459</a></li>
<li>upgrade module to esm and update dependencies by <a
href="https://github.com/aiqiaoy"><code>@​aiqiaoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2463">actions/checkout#2463</a></li>
<li>Bump the minor-npm-dependencies group across 1 directory with 3
updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2462">actions/checkout#2462</a></li>
<li>getting ready for checkout v7 release by <a
href="https://github.com/aiqiaoy"><code>@​aiqiaoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2464">actions/checkout#2464</a></li>
<li>update error wording by <a
href="https://github.com/aiqiaoy"><code>@​aiqiaoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2467">actions/checkout#2467</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/aiqiaoy"><code>@​aiqiaoy</code></a> made
their first contribution in <a
href="https://redirect.github.com/actions/checkout/pull/2454">actions/checkout#2454</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/checkout/compare/v6.0.3...v7.0.0">https://github.com/actions/checkout/compare/v6.0.3...v7.0.0</a></p>
<h2>v6.0.3</h2>
<h2>What's Changed</h2>
<ul>
<li>Update changelog by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2357">actions/checkout#2357</a></li>
<li>fix: expand merge commit SHA regex and add SHA-256 test cases by <a
href="https://github.com/yaananth"><code>@​yaananth</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2414">actions/checkout#2414</a></li>
<li>Fix checkout init for SHA-256 repositories by <a
href="https://github.com/yaananth"><code>@​yaananth</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2439">actions/checkout#2439</a></li>
<li>Update changelog for v6.0.3 by <a
href="https://github.com/yaananth"><code>@​yaananth</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2446">actions/checkout#2446</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/yaananth"><code>@​yaananth</code></a>
made their first contribution in <a
href="https://redirect.github.com/actions/checkout/pull/2414">actions/checkout#2414</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/checkout/compare/v6...v6.0.3">https://github.com/actions/checkout/compare/v6...v6.0.3</a></p>
<h2>v6.0.2</h2>
<h2>What's Changed</h2>
<ul>
<li>Add orchestration_id to git user-agent when ACTIONS_ORCHESTRATION_ID
is set by <a
href="https://github.com/TingluoHuang"><code>@​TingluoHuang</code></a>
in <a
href="https://redirect.github.com/actions/checkout/pull/2355">actions/checkout#2355</a></li>
<li>Fix tag handling: preserve annotations and explicit fetch-tags by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2356">actions/checkout#2356</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/checkout/compare/v6.0.1...v6.0.2">https://github.com/actions/checkout/compare/v6.0.1...v6.0.2</a></p>
<h2>v6.0.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Update all references from v5 and v4 to v6 by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2314">actions/checkout#2314</a></li>
<li>Add worktree support for persist-credentials includeIf by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2327">actions/checkout#2327</a></li>
<li>Clarify v6 README by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2328">actions/checkout#2328</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/checkout/compare/v6...v6.0.1">https://github.com/actions/checkout/compare/v6...v6.0.1</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/actions/checkout/blob/main/CHANGELOG.md">actions/checkout's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<h2>v7.0.0</h2>
<ul>
<li>Block checking out fork PR for pull_request_target and workflow_run
by <a href="https://github.com/aiqiaoy"><code>@​aiqiaoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2454">actions/checkout#2454</a></li>
<li>Bump actions/publish-immutable-action from 0.0.3 to 0.0.4 in the
minor-actions-dependencies group across 1 directory by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2458">actions/checkout#2458</a></li>
<li>Bump flatted from 3.3.1 to 3.4.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2460">actions/checkout#2460</a></li>
<li>Bump js-yaml from 4.1.0 to 4.2.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2461">actions/checkout#2461</a></li>
<li>Bump <code>@​actions/core</code> and
<code>@​actions/tool-cache</code> and Remove uuid by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2459">actions/checkout#2459</a></li>
<li>upgrade module to esm and update dependencies by <a
href="https://github.com/aiqiaoy"><code>@​aiqiaoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2463">actions/checkout#2463</a></li>
<li>Bump the minor-npm-dependencies group across 1 directory with 3
updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/actions/checkout/pull/2462">actions/checkout#2462</a></li>
</ul>
<h2>v6.0.3</h2>
<ul>
<li>Fix checkout init for SHA-256 repositories by <a
href="https://github.com/yaananth"><code>@​yaananth</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2439">actions/checkout#2439</a></li>
<li>fix: expand merge commit SHA regex and add SHA-256 test cases by <a
href="https://github.com/yaananth"><code>@​yaananth</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2414">actions/checkout#2414</a></li>
</ul>
<h2>v6.0.2</h2>
<ul>
<li>Fix tag handling: preserve annotations and explicit fetch-tags by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2356">actions/checkout#2356</a></li>
</ul>
<h2>v6.0.1</h2>
<ul>
<li>Add worktree support for persist-credentials includeIf by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2327">actions/checkout#2327</a></li>
</ul>
<h2>v6.0.0</h2>
<ul>
<li>Persist creds to a separate file by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2286">actions/checkout#2286</a></li>
<li>Update README to include Node.js 24 support details and requirements
by <a href="https://github.com/salmanmkc"><code>@​salmanmkc</code></a>
in <a
href="https://redirect.github.com/actions/checkout/pull/2248">actions/checkout#2248</a></li>
</ul>
<h2>v5.0.1</h2>
<ul>
<li>Port v6 cleanup to v5 by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2301">actions/checkout#2301</a></li>
</ul>
<h2>v5.0.0</h2>
<ul>
<li>Update actions checkout to use node 24 by <a
href="https://github.com/salmanmkc"><code>@​salmanmkc</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2226">actions/checkout#2226</a></li>
</ul>
<h2>v4.3.1</h2>
<ul>
<li>Port v6 cleanup to v4 by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2305">actions/checkout#2305</a></li>
</ul>
<h2>v4.3.0</h2>
<ul>
<li>docs: update README.md by <a
href="https://github.com/motss"><code>@​motss</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1971">actions/checkout#1971</a></li>
<li>Add internal repos for checking out multiple repositories by <a
href="https://github.com/mouismail"><code>@​mouismail</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1977">actions/checkout#1977</a></li>
<li>Documentation update - add recommended permissions to Readme by <a
href="https://github.com/benwells"><code>@​benwells</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2043">actions/checkout#2043</a></li>
<li>Adjust positioning of user email note and permissions heading by <a
href="https://github.com/joshmgross"><code>@​joshmgross</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2044">actions/checkout#2044</a></li>
<li>Update README.md by <a
href="https://github.com/nebuk89"><code>@​nebuk89</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2194">actions/checkout#2194</a></li>
<li>Update CODEOWNERS for actions by <a
href="https://github.com/TingluoHuang"><code>@​TingluoHuang</code></a>
in <a
href="https://redirect.github.com/actions/checkout/pull/2224">actions/checkout#2224</a></li>
<li>Update package dependencies by <a
href="https://github.com/salmanmkc"><code>@​salmanmkc</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2236">actions/checkout#2236</a></li>
</ul>
<h2>v4.2.2</h2>
<ul>
<li><code>url-helper.ts</code> now leverages well-known environment
variables by <a href="https://github.com/jww3"><code>@​jww3</code></a>
in <a
href="https://redirect.github.com/actions/checkout/pull/1941">actions/checkout#1941</a></li>
<li>Expand unit test coverage for <code>isGhes</code> by <a
href="https://github.com/jww3"><code>@​jww3</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1946">actions/checkout#1946</a></li>
</ul>
<h2>v4.2.1</h2>
<ul>
<li>Check out other refs/* by commit if provided, fall back to ref by <a
href="https://github.com/orhantoy"><code>@​orhantoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1924">actions/checkout#1924</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/actions/checkout/commit/9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0"><code>9c091bb</code></a>
update error wording (<a
href="https://redirect.github.com/actions/checkout/issues/2467">#2467</a>)</li>
<li><a
href="https://github.com/actions/checkout/commit/1044a6dea927916f2c38ba5aeffbc0a847b1221a"><code>1044a6d</code></a>
getting ready for checkout v7 release (<a
href="https://redirect.github.com/actions/checkout/issues/2464">#2464</a>)</li>
<li><a
href="https://github.com/actions/checkout/commit/f0282184c7ce73ab54c7e4ab5a617122602e575f"><code>f028218</code></a>
Bump the minor-npm-dependencies group across 1 directory with 3 updates
(<a
href="https://redirect.github.com/actions/checkout/issues/2462">#2462</a>)</li>
<li><a
href="https://github.com/actions/checkout/commit/d914b262ffc244530a203ab40decab34c3abf34d"><code>d914b26</code></a>
upgrade module to esm and update dependencies (<a
href="https://redirect.github.com/actions/checkout/issues/2463">#2463</a>)</li>
<li><a
href="https://github.com/actions/checkout/commit/537c7ef99cef6e5ddb5e7ff5d16d14510503801d"><code>537c7ef</code></a>
Bump <code>@​actions/core</code> and <code>@​actions/tool-cache</code>
and Remove uuid (<a
href="https://redirect.github.com/actions/checkout/issues/2459">#2459</a>)</li>
<li><a
href="https://github.com/actions/checkout/commit/130a169078a413d3a5246a393625e8e742f387f6"><code>130a169</code></a>
Bump js-yaml from 4.1.0 to 4.2.0 (<a
href="https://redirect.github.com/actions/checkout/issues/2461">#2461</a>)</li>
<li><a
href="https://github.com/actions/checkout/commit/7d09575332117a40b46e5e020664df234cd416f3"><code>7d09575</code></a>
Bump flatted from 3.3.1 to 3.4.2 (<a
href="https://redirect.github.com/actions/checkout/issues/2460">#2460</a>)</li>
<li><a
href="https://github.com/actions/checkout/commit/0f9f3aa320cb53abeb534aeb54048075d9697a0e"><code>0f9f3aa</code></a>
Bump actions/publish-immutable-action (<a
href="https://redirect.github.com/actions/checkout/issues/2458">#2458</a>)</li>
<li><a
href="https://github.com/actions/checkout/commit/f9e715a95fcd1f9253f77dd28f11e88d2d6460c7"><code>f9e715a</code></a>
block checking out fork pr for pull_request_target and workflow_run (<a
href="https://redirect.github.com/actions/checkout/issues/2454">#2454</a>)</li>
<li>See full diff in <a
href="https://github.com/actions/checkout/compare/v6...v7">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=6&new-version=7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ontrib#3846)

This file was not intended to be tracked in the repository, so it has
been removed.
This implements a pypi hub that is the union of all pypi hubs.

The basic design is:
* The `pip` extension _always_ creates a `@pypi` repo unless the name
  is already taken by another hub definition.
* The `--pypi_hub` flag dispatches to one of the hubs. If not set,
  then it uses a default one (first, or as configured)

The set of packages and targets the unified hub exposes is a union
of all other hubs. If the unified hub routes to a hub that doesn't
support such a target, then it points to a target that fails at
execution time. This is to allow query and cquery to work even if
some targets don't exist in some hubs.
The strategy for this is:
* First add a way for us to create a `uv.lock` file from the `lock`
rule.
* Then add a `uv.lock` reader via the bazel toml parser.
* Then plug the code into the `parse_requirements` function so that we
  can reuse the most of code already there.
* Add some sample docs for the `uv.lock`.

Extra things that we could do:

* Call the PyPI index to understand if the packages are yanked or not -
lock
  file does not have that information.
* Read the `pyproject.toml` file to get the index values for each
package.
* Add e2e tests from `rules_py` test suite.

Closes bazel-contrib#3557
Work towards bazel-contrib#2787

---------

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
Co-authored-by: Richard Levasseur <rlevasseur@google.com>
…ntrib#3849)

Add a workspace-specific agent rule to ensure that new
conversations/sessions and branches are always based on the latest
upstream code to avoid using outdated code states.

This comes about after having several sessions go haywire at the start
because they
didn't see the latest changes.
rickeylev and others added 7 commits June 28, 2026 06:56
…trib#3859)

Create a workflow for lighter weight PR checks. These just check basic
things
about a PR, e.g. markers to prevent submit, blocking files that
shouldn't
be checked in.
To make it easier to manage the many bzl_library targets we have, switch
to using
gazelle to do so.

Unfortunately, gazelle has strong opinions about target names: it forces
`{foo}` names and doesn't allow `{foo}_bzl` names. Trying to make it do
so requires
quite a bit of gazelle directives.

Instead, rename all the internal targets, but create aliases for public
targets.

Along the way...
* Delete unused py_args.bzl
* Add agent rule to avoid inappropriate copyright
* Add a skill for creating rules
…ib#3861)

The pr-metadata-checks workflow was failing because gh pr diff requires
a git repository context when run without target repository information.
We now explicitly pass the repository using the --repo flag, allowing
the job to run successfully without needing a full repository checkout.
## Summary

Add an `extract_needs_chmod` config flag that controls whether `chmod`
is run after extracting wheel files. The flag is `False` for Bazel
>= 8.6 (where the fix for file permissions is built into Bazel) and
`True` for older versions.

Move `_maybe_fix_permissions` from `whl_extract.bzl` into
`repo_utils.bzl` and have `_extract` call it conditionally based
on the config flag. This ensures both `whl_extract` and `patch_whl`
benefit from the chmod fix when needed.

Whilst at it migrate tests to common mocks.

Fixes bazel-contrib#3585
Closes bazel-contrib#3860
Make the check run on edit so that it can detect adding/removing of the
special marker text.
This is no longer used starting when we enabled pipstar by default and
did a code cleanup where Python is no longer used to extract the wheels.

Split from bazel-contrib#3856
…azel-contrib#3866)

This change refactors the release promotion tool to ensure all
pre-conditions are verified before making any modifications and
automates post-promotion tracking updates. It also fixes a bug where the
tool incorrectly assumed 'v' prefixes when identifying the latest
release candidate and computing the final version tag.
rickeylev and others added 18 commits July 3, 2026 20:28
…d-backports accept hashtag and url refs (bazel-contrib#3897)

Currently, backports must be manually added to the release tracking
issue.
This change automates the process by allowing maintainers to comment
`/backport`
on a PR to add it to the active release's backport checklist, and
automatically
triggering the backport processing when the PR is merged.

To support this, the following changes were made:
- Added `add-backports` subcommand to the release tool to append PRs to
the tracking issue.
- Added `on-pr-merged` subcommand to verify `/backport` comment, find
the tracking issue, and process backports.
- Created `release_add_backports.yaml` reusable workflow to run the
`add-backports` subcommand.
- Updated `on_comment.yaml` to parse `/backport` comments on PRs and
trigger the addition.
- Created `on_pr_closed.yaml` to detect merged PRs and run the
`on-pr-merged` subcommand.
- Added unit tests for the new subcommands and URL resolution.
…ntrib#3898)

chore(release): fix promote_rc arguments and align comments

`promote_rc.py` was calling `Git.fetch` with `refspec` keyword argument
which was not supported by `Git.fetch` signature, leading to fatal
errors.
The release promotion comment format was different from the release
candidate creation comment format, leading to inconsistency.

- Added `refspec` argument support to `Git.fetch` in `git.py`.
- Added `sys.argv` printing at startup in `release.py` for debugging.
- Updated `promote_rc.py` comment body to match `create_rc.py` style and
added necessary helper variables.
- Updated `git_test.py` to test `Git.fetch` with `refspec`.
- Updated `promote_rc_test.py` to match the new comment format.
…l-contrib#3899)

Currently, the `promote-rc` command fails because it calls
`Git.get_commit_sha` with an invalid keyword argument `remote_ref`.
Additionally, we want to align argument passing in the workflow with the
`=` style.

To fix this:
- Remove the invalid `remote_ref` keyword argument from
`Git.get_commit_sha` call in `promote_rc.py`.
- Update `promote_rc_test.py` mock assertions to match the corrected
call.
- Update `release_promote_rc.yaml` to pass `--issue` and `--remote`
arguments using `=`.
…w to finish publishing (bazel-contrib#3900)

Why: The tagging done by promote_rc doesn't trigger the on-tag trigger
of the publish workflow (due to GITHUB_TOKEN restriction).

How:
- Modified promote_rc.py to output the promoted version to
GITHUB_OUTPUT.
- Modified release_promote_rc.yaml to capture this version and chain the
release_publish workflow.
- Added unit tests for GITHUB_OUTPUT writing in promote_rc_test.py.
The 2.2 release was completed, but the changelog updates and news file
deletions were only performed on the release branch. We need to sync
these changes back to main so that they are reflected in the unreleased
state and future releases.
…kports (bazel-contrib#3903)

This PR implements the changes to sync both CHANGELOG.md and version
next markers to the `main` branch when backports are processed.

Key changes:
- Adds git `diff`, `apply`, and `apply_check` helpers to the release
tool.
- Updates the GitHub helper to support custom PR base and auto-merge.
- Updates `changelog_news.py` to support selective news merging and
correct semver-sorted insertion, while preserving the static
`Unreleased` section.
- Updates `process_backports.py` to collect version marker diffs during
cherry-pick, check if they apply cleanly to main, apply them, and report
any failures in the PR body.

These changes ensure that the `main` branch's changelog and version
markers remain in sync with the release branch during the backport
process.
…rib#3904)

This news file was left over from a previous release process and is no
longer needed.

Removed the file `news/process-backports-before-rc.changed.md`.
Quote the 'if' condition in release_create_release_branch.yaml to fix
YAML syntax error.
…ntrib#3910)

Bumps [astral-sh/ruff-action](https://github.com/astral-sh/ruff-action)
from 4.0.0 to 4.1.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/278981a28ce3188b1e39527901f38254bf3aac89"><code>278981a</code></a>
Add option to skip Astral mirror downloads (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/387">#387</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/c35f46c92bb002594f380fe551593c23fe2f2c5d"><code>c35f46c</code></a>
chore: roll up Dependabot updates (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/386">#386</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/f3db229c84ab49dc0bc715c3e87e099b99c943d2"><code>f3db229</code></a>
feat: support uv.lock as version-file (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/379">#379</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/270e80dfe771096cac6ac76ff7e22cc948d9fc3f"><code>270e80d</code></a>
Fix wildcard src input (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/368">#368</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/5fedeebdb3a98a08e28580dfbf53e4e021c715a7"><code>5fedeeb</code></a>
Add Dependabot rollup skill (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/385">#385</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/99fe79f472e5112a6ade4da0b57272b436149c34"><code>99fe79f</code></a>
chore: update known checksums for 0.15.20 (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/383">#383</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/32ad1b993e7eb0b4225e4cab5df2f6c5e154a65f"><code>32ad1b9</code></a>
chore: update known checksums for 0.15.19 (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/382">#382</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/f78e087041f3e90b68678ad4e39bf14eceb68084"><code>f78e087</code></a>
chore: update known checksums for 0.15.18 (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/381">#381</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/2f886796233dd932a419c469cee06063a017922e"><code>2f88679</code></a>
chore: update known checksums for 0.15.17 (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/380">#380</a>)</li>
<li><a
href="https://github.com/astral-sh/ruff-action/commit/b79a7ac759a34911be97ecdf3d744c213336da60"><code>b79a7ac</code></a>
chore: update known checksums for 0.15.16 (<a
href="https://redirect.github.com/astral-sh/ruff-action/issues/378">#378</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/astral-sh/ruff-action/compare/v4.0.0...v4.1.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=astral-sh/ruff-action&package-manager=github_actions&previous-version=4.0.0&new-version=4.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This is so that the purl can be generated correctly and we
pass the right index_url parameter to the whl_library file.

Work towards bazel-contrib#1975

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Richard Levasseur <richardlev@gmail.com>
Free gemini code assist is being disabled in a few weeks, and I've found
the ai
reviews useful enough to want to keep them, so replace it with a custom
agent
based upon the antigravity sdk that does code reviews.

I've added a Gemini API key to the project for it to use. It's free-tier
level quota, so is relatively limited, hence reviews are limited to
project
maintainer PRsor when a maintainer comments `/review`.
…forward it to the generated `py_binary` (bazel-contrib#3865)

As stated in bazel-contrib#3858, the `compile_pip_requirements` macro accepts a
`data` attribute, but this attribute is not forwarded to the internal
`py_binary` target generated for the `.update` target.

As a result, using `$(location :pip_cert)` inside `extra_args` fails
during analysis because the generated `py_binary` does not declare
`:pip_cert` as a prerequisite.

Before:
```
ERROR: /.../BUILD.bazel:8:25: in args attribute of py_binary rule //:requirements.update: label '//:pip_cert' in $(location) expression is not a declared prerequisite of this rule. Since this rule was created by the macro 'pip_compile', the error might have been caused by the macro implementation
ERROR: /.../BUILD.bazel:8:25: Analysis of target '//:requirements.update' (config: 7f8856b) failed
ERROR: Analysis of target '//:requirements.update' failed; build aborted
```

After:
```
INFO: Analyzed target //:requirements.update (87 packages loaded, 4078 targets configured).
INFO: Found 1 target...
Target //:requirements.update up-to-date:
  bazel-bin/requirements.update
INFO: Elapsed time: 6.240s, Critical Path: 0.11s
INFO: 1 process: 11 action cache hit, 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/requirements.update '--src=rules_python_pip_parse_example/requirements.in' rules_python_pip_parse_example/requirements_lock.txt //:requirements '--resolver=backtracking' --allow-unsafe --generate-hashes '--cert=./pip.cert'
```

Closes bazel-contrib#3858

---------

Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
Co-authored-by: Richard Levasseur <richardlev@gmail.com>
…bazel-contrib#3918)

Currently, the automated PR review workflow requires a diff review
comment (`pull_request_review_comment`) to trigger on-demand reviews via
`/review`. This prevents maintainers from triggering reviews from
regular conversation comments on pull requests.

To fix, change the event trigger from `pull_request_review_comment` to
`issue_comment`, ensure the event is on a pull request by checking
`github.event.issue.pull_request != null`, and check out
`refs/pull/$NUMBER/head` so the PR branch is retrieved during comment
events.

* Also checks `\r\n/review` when parsing comment body for multiline
`/review` commands.
…azel-contrib#3921)

Currently, running `antigravity_review.py` with `uv run` fails because
it lacks PEP 723 dependency metadata and passes `system_instructions` to
`Agent` instead of `LocalAgentConfig`. Also, `skills_paths` points to
the skill directory rather than the `SKILL.md` file.

To fix, add inline PEP 723 script metadata declaring dependencies, pass
`system_instructions` to `LocalAgentConfig`, and target `SKILL.md`
directly in `skills_paths`.
We had to disable the `sphinxdocs` persistent worker in Pigweed
(https://pwbug.dev/493749800) because the cache invalidation logic
seemed incomplete with regards to Git branches. E.g. in branch `feat`
you create a new doc `foo.rst`. You switch back to branch `main` and try
to build Sphinx, but Sphinx warns about needing to ignore unreadable
document `foo.rst`. Because Pigweed builds Sphinx with
`--fail-on-warning` this would break our docs build. This PR adds the
bug fix and also starts a suite of tests that will be focused on
persistent worker correctness.

---------

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
…bazel-contrib#3920)

Currently, several internal macros, toolchain definitions, and
config settings either hardcode \`["//visibility:public"]\` or define
private copies like \`_NOT_ACTUALLY_PUBLIC\`. This scatters visibility
workarounds across the codebase and makes developer intent unclear.

To clean this up, transition internal rules across \`python/private\` to
use \`NOT_ACTUALLY_PUBLIC\` from \`python/private/visibility.bzl\`, and
update corresponding \`bzl_library\` dependencies to match.
…e rule builders (bazel-contrib#3919)

`create_executable_rule_builder()` (used by `py_binary_rule_builder()` /
`py_test_rule_builder()`, the public `python/api/executables.bzl` API)
bundles three implicit attrs whose defaults point at private targets
under `//python/private`: `build_data_writer`,
`debugger_if_target_config`, and `uncachable_version_file`. These
targets had no explicit visibility, so they inherited the package's
`default_visibility` (`//:__subpackages__`), which only covers packages
inside the rules_python repo itself.

Because the builder API is designed to let external modules call
`rule()` themselves (via `builder.build()`), Bazel checks visibility of
these attr defaults from the *calling* module's package, not from
rules_python's. Any external repo constructing a rule via
`py_binary_rule_builder()` / `py_test_rule_builder()` therefore fails at
analysis time with a visibility error.

This has been broken since the builder API's introduction; there's prior
art in this same file for exactly this situation (e.g.
`stage1_bootstrap_template`, among others)

Co-authored-by: Richard Levasseur <richardlev@gmail.com>
…azel-contrib#3922)

Currently, `LocalAgentConfig` only configures a single default model
without an explicit endpoint attached when passing `ModelTarget`
objects, which causes startup errors (`must have an endpoint
configured`) or rate-limit failures when quota runs short.

To fix, import `GeminiAPIEndpoint` and `ModelTarget`, create an explicit
endpoint (`GeminiAPIEndpoint()`), and configure a prioritized
multi-model cascade across all major Gemini 3 and Gemini 2 models so the
agent automatically falls back to whichever model has open quota and
full function calling capabilities.
@rsartor-cmd
rsartor-cmd force-pushed the py-extension branch 2 times, most recently from acf55b4 to aab3cee Compare July 15, 2026 17:22
rickeylev and others added 9 commits July 17, 2026 22:05
...and sycophantic toasters are bad collaborators
…el-contrib#3851)

This builds on the existing `py-extension` branch. It adds support for
platform and abi tags in the resulting library filename. The
`:py_extension_test`, `:py_extension_analysis_tests`, and
`:py_limited_api_tests` test targets in `//tests/cc/py_extension` now
build and pass.

Relates to bazel-contrib#3283
…tension (bazel-contrib#3875)

Per feedback from bazel-contrib#3851, this PR re-works the platform detection logic
to rely on platform constraints instead of the Python runtime/toolchain.

### Description

This PR contains updates to the experimental `py_extension`
implementation. It re-works the platform tag detection to rely on modern
platform constraints, and refactors the compilation and linking
mechanism
to delegate to Bazel's native `cc_shared_library` and `cc_library`
rules.

This PR targets the main repository's `py-extension` branch (not
`main`).

### Key Changes

#### 1. Platform Tag & ABI Tag Derivation
* **Introduced `abi_tag` to `PyCcToolchainInfo`**: Added the `abi_tag`
field to the `PyCcToolchainInfo` provider, populated by the
`py_cc_toolchain` rule. It defaults to deriving the tag from
`python_version` (e.g. `cpython-311`) for backward compatibility.
* **Constraint-Based Detection**: Replaced legacy parsing of
`cc_toolchain` CPU names with direct lookup in rules_python's central
`PLATFORMS` registry using platform constraints.
* **Limited API Configuration**: Updated how limited API (`.abi3.so`)
suffixes are appended based on the toolchain configuration.

#### 2. Compilation & Linking Delegation (Refactor to
`cc_shared_library`)
* **Macro Fusion**: Replaced the custom linking logic in the
`py_extension` rule with a macro of the same name. It now accepts C/C++
source/header files directly (`srcs`, `hdrs`, `copts`, `defines`),
implicitly wrapping them in a private `cc_library` under the hood.
* **Consolidated Attributes**: Consolidated static linkage under
standard `deps` (removing the redundant `static_deps` attribute) and
aligned linker arguments with `cc_shared_library`'s `user_link_flags`.
* **Wrapper Rule (`_py_extension_wrapper`)**: Added a lightweight,
private rule that wraps the `cc_shared_library` output to:
* Query the Python toolchain for platform/ABI tags to resolve PEP 3149
compliant filenames (e.g. `.cpython-311-x86_64-linux-gnu.so` or
`.abi3.so`).
*   Create a cheap `symlink` from the CSL output to the PEP 3149 name.
* Propagate `PyInfo` (for python rules) and `CcSharedLibraryInfo` (for
dynamic C++ dependencies).
* **ODR Validation**: Leveraging native `cc_shared_library` ensures
strict analysis-time validation against One Definition Rule (ODR)
violations (e.g., duplicate static linkage in dynamic chains).

#### 3. Runfiles and Data Support
* **Runfiles Propagation**: Re-implemented runfiles collection using the
repository's standard `builders.RunfilesBuilder` to support runtime
assets (`data` attribute) and dynamic library dependency
propagation.

### Verification & Testing
* Added parity test cases in `dependency_graph_tests.bzl` to verify
dynamic dependency chains and static sharing behavior.
* Added runfiles validation in `py_extension_tests.bzl` to verify data
asset propagation.
*   Updated limited API tests to match CSL output structure.
* All 14 tests in `//tests/cc/py_extension/...` are compiling and
passing.
──────
TAG=agy
CONV=23f8a5e8-2d99-401a-9903-1256b7d42b0e

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.