Skip to content

Agent: bundle the python tool's CPython in Linux packages - #1414

Draft
AnthonyRonning wants to merge 1 commit into
agent/python-packaging-macosfrom
agent/python-packaging-linux
Draft

AnthonyRonning wants to merge 1 commit into
agent/python-packaging-macosfrom
agent/python-packaging-linux

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fourth layer of the CodeMode catch-up stack, on PR #1412 (macOS packaging). Linux tar bundles and the Nix package now carry the CPython runtime the python tool runs.

What changed

  • AppDir staging (scripts/linux-release-appimage.py): staging puts the hash-pinned x86_64-unknown-linux-gnu runtime in usr/share/maple-agent/python, where the app's package resolver looks beside usr/bin. Hard links are copied as files and symlinks are kept.
  • Nix package: Port bundled CPython and ordered CodeMode into Maple Agent #897's derivation, moved to python314. Its version must equal the pin (3.14.7 on both sides), and postInstall copies it into share/maple-agent/python. The Intel-macOS dev shell input from Port bundled CPython and ordered CodeMode into Maple Agent #897 is gone with Intel macOS.
  • All platforms: Tcl/Tk, tkinter, IDLE and turtledemo are left out by prepare-python.py. Python Build Standalone's Linux libtcl9.0.so and libtcl9tk9.0.so carry an absolute build-host RPATH (/tools/deps/lib). That path would let anyone who can create that directory inject libraries. The worker has no use for Tk GUIs. Pruning saves 10.6 MB / 323 files on Linux, and the macOS runtime drops from 69 MB to 59 MB. The pruned paths are part of a prepared runtime's identity, so stale trees re-prepare.

What the Linux runtime looks like

Inspected from the pinned archive:

  • 9 ELF files remain before pruning. Most extension modules are built into libpython.
  • bin/python3.14 uses /lib64/ld-linux-x86-64.so.2 with RPATH $ORIGIN/../lib.
  • Everything needs at most GLIBC_2.17.
  • libpython3.so names its dependency as $ORIGIN/../lib/libpython3.14.so.1.0, which resolves inside the runtime.

Rebased onto master's simplified release tooling. That tooling no longer audits AppDir ELF files or runs the Docker check, so the audit branch and stock-Ubuntu probe an earlier revision added went with them. Before the rebase, the ci:package Linux rehearsal passed with them on both pinned Ubuntu images: it staged the runtime, audited its ELF files, and imported its native modules.

Validation

  • just python-test (prepare-script tests, including pruning, and the worker suite) and the maple-code-mode tests pass against the pruned macOS runtime.
  • nix eval of packages.{x86_64,aarch64}-linux.python-runtime and packages.x86_64-linux.default succeeds, version assertion included. No lane builds the Agent's Nix package; that build was not run here (this machine has no Linux builder).
  • ci:package re-runs the Linux package rehearsal on the rebased branch.

🤖 Generated with Claude Code

@AnthonyRonning AnthonyRonning added the ci:package Build unsigned packages on this PR label Nov 1, 2026
@AnthonyRonning AnthonyRonning changed the title Bundle the python tool's CPython in Linux packages Agent: bundle the python tool's CPython in Linux packages Nov 1, 2026
The AppDir stages the hash-pinned x86_64 runtime into
usr/share/maple-agent/python, where the app's package resolver looks,
before the runtime audit is recorded. The audit gives its ELF files
their own branch: the host loader and glibc libraries, $ORIGIN paths
that stay inside the runtime, and the 2.31 glibc floor. It records them
as `python_runtime_elves` (audit schema 4). The Docker check imports
the interpreter's native modules on the stock Ubuntu images.

Every prepared runtime now leaves out Tcl/Tk, tkinter, IDLE and
turtledemo. The worker has no use for Tk GUIs, and Python Build
Standalone's Linux Tcl/Tk libraries carry an absolute build-host RPATH
(/tools/deps/lib) that the audit rightly refuses.

The Nix package copies the locked nixpkgs python314, which matches the
pinned 3.14.7, into share/maple-agent/python (#897's derivation).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AnthonyRonning
AnthonyRonning force-pushed the agent/python-packaging-linux branch from 1bf983a to fc22c56 Compare November 2, 2026 01:20

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

ci:package Build unsigned packages on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant