Skip to content

feat(toolchains): allow selecting stripped python-build-standalone archives - #4192

Open
gfrankliu wants to merge 1 commit into
bazel-contrib:mainfrom
gfrankliu:feat/stripped-python-archives
Open

gfrankliu wants to merge 1 commit into
bazel-contrib:mainfrom
gfrankliu:feat/stripped-python-archives

Conversation

@gfrankliu

Copy link
Copy Markdown
Contributor

Runtimes always used install_only archives, which include debug symbols. The install_only_stripped variants are much smaller; for example, a Python 3.14 zipapp shrinks from 147 MB to 65 MB.

Add python.override(archive_flavor) with install_only (default), install_only_stripped, and full. The manifest sort key is shared and prefers the selected flavor, falling back when unavailable. Built-in manifest entries now include stripped archive hashes for releases from 20240726 onward, sourced from the official SHA256SUMS files.

Fixes #4163

…chives

Runtimes always used install_only archives, which include debug symbols. The install_only_stripped variants are much smaller; for example, a Python 3.14 zipapp shrinks from 147 MB to 65 MB.

Add python.override(archive_flavor) with install_only (default), install_only_stripped, and full. The manifest sort key is shared and prefers the selected flavor, falling back when unavailable. Built-in manifest entries now include stripped archive hashes for releases from 20240726 onward, sourced from the official SHA256SUMS files.

Fixes bazel-contrib#4163
Copilot AI lite review requested due to automatic review settings September 28, 2026 05:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Add coverage for the full flavor and address the noted release-note and formatting issues.

Review effort: Lite
Findings: 1 Medium severity · 3 Low severity

Open (4)
What changed in this PR

Adds configurable Python standalone archive flavors, including stripped archives and fallback selection.

Changes:

  • Adds archive_flavor override support.
  • Updates manifest ranking and stripped archive hashes.
  • Adds tests, documentation, mocks, and release notes.
File Summary
tests/​support/​mocks/​python_ext.bzl Updates mock override attributes.
tests/​python/​python_tests.bzl Tests archive selection and fallback behavior.
python/​versions.bzl Reuses shared manifest sorting.
python/​private/​runtimes_manifest.txt Adds stripped archive checksums.
python/​private/​python.bzl Implements archive flavor configuration.
python/​private/​pbs_manifest.bzl Defines flavor-aware manifest ranking.
news/​stripped-python-archives.added.md Adds the release note.
docs/​toolchains.md Documents archive flavor selection.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/private/python.bzl
Comment on lines +1316 to +1324
Valid values are `install_only`, `install_only_stripped`, and `full`. Use
`install_only_stripped` to reduce runtime and zipapp size by omitting debug
symbols. If the preferred flavor is unavailable for a runtime, another
available flavor is used.

:::{versionadded} VERSION_NEXT_FEATURE
:::
""",
values = ["install_only", "install_only_stripped", "full"],
@@ -0,0 +1,3 @@
(toolchains) Added {attr}`python.override.archive_flavor` to select
@@ -0,0 +1,3 @@
(toolchains) Added {attr}`python.override.archive_flavor` to select
`install_only_stripped` python-build-standalone archives, which omit debug
symbols and reduce runtime and zipapp size.
Comment on lines +478 to +482
tool_versions = _parse_archive_flavor_modules("install_only_stripped").config.default["tool_versions"]
platform = "x86_64-unknown-linux-gnu"

env.expect.that_str(tool_versions["3.14.4"]["sha256"][platform]).equals("2" * 64)
env.expect.that_str(tool_versions["3.14.4"]["url"][platform][0]).contains("install_only_stripped")

This branch has not been deployed

No deployments
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.

zipapp exploded the python interpreter

2 participants