← Back to issue list

fix(snap): install python3-apt as a stage-package instead of building from source

View original Github issue

Metadata

Project
charmcraft
Number
#2818
Type
pull request
State
merged
Author
lengau
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR canonical/charmcraft#2818 by lengau: snap build no longer builds python-apt from source via uv; python3-apt added to charmcraft-libs stage-packages and organized into the venv site-packages. Removed requirements-noble.txt and libapt-pkg-dev.

Resolution: closed resolved

Reason: The PR itself is the fix and was merged (state: merged, approved by 2 reviewers,3 files changed, +13/-12). It removes the failing `uv pip install -r requirements-noble.txt` step from snap/snapcraft.yaml and instead installs python3-apt as an apt stage-package with an organize mapping into lib/python3.12/site-packages, sidestepping uv's PEP 625 .tar.xz rejection.

Evaluated by: mr-cal-bot

No scores available.

Issue body

## Problem The snap build fails with the current `uv` version: \`\`\` error: Source distribution \`https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.7.7ubuntu5/python-apt_2.7.7ubuntu5.tar.xz\` has a non-PEP 625-compliant filename; only \`.tar.gz\` and \`.zip\` archives are accepted \`\`\` `uv` now hard-rejects source distributions whose filenames aren't PEP 625 compliant (only `.tar.gz`/`.zip`), and Launchpad only serves the `python-apt` source tarball as `.tar.xz`. There's no `uv` flag to bypass this check, so `requirements-noble.txt` (installed via `uv pip install` in the snap's `override-build`) can no longer be used. We also can't switch to the prebuilt `python-apt` wheels used for local dev (`python-apt-wheels` index in `pyproject.toml`), since the snap is built with `PIP_NO_BINARY`/`UV_NO_BINARY` set to force building everything from source (to avoid issues like #1369), and those wheels aren't built in a way that's safe to ship in the snap. ## Fix Install `python3-apt` as a normal apt stage-package in the `charmcraft-libs` part (alongside its shared library and other runtime deps, resolved automatically by snapcraft), and `organize` its files into the charmcraft venv's `site-packages`, instead of trying to `pip`/`uv` install it from source. This sidesteps the PEP 625 restriction entirely and avoids compiling `python-apt` at build time. - Removed `requirements-noble.txt` and the `uv pip install -r requirements-noble.txt` step from `snap/snapcraft.yaml`. - Added `python3-apt` to `charmcraft-libs` stage-packages, with an `organize` mapping (using globs for the arch/version-specific `.so` files) into `lib/python3.12/site-packages/`. - Dropped the now-unneeded `libapt-pkg-dev` build-package (only needed for compiling `python-apt` from source). - Updated a stale comment in `.github/workflows/policy.yaml` referencing the removed `requirements-noble.txt`. ## Testing - Built the snap locally with `snapcraft_edge pack --platform amd64`: succeeds. - Installed the resulting snap and confirmed `apt`/`apt_pkg`/`apt_inst`/ `aptsources` are present under `lib/python3.12/site-packages` and importable, and `charmcraft --version` works. - Running the full `spread -reuse -resend multipass:` suite to confirm no regressions before taking this out of draft. Marking as **draft** until the full spread suite finishes.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR canonical/charmcraft#2818 by lengau: snap build no longer builds python-apt from source via uv; python3-apt added to charmcraft-libs stage-packages and organized into the venv site-packages. Removed requirements-noble.txt and libapt-pkg-dev.
stealth/space-bunny-alpha — closed resolved Merged in canonical/charmcraft#2818: the snap now installs python3-apt as a stage-package and organizes it into site-packages instead of installing the rejected .tar.xz source.
qwen/qwen3.6-35b-a3b — — Merged. Fixed snap build failures from uv rejecting non-PEP 625-compliant python-apt sources by installing python3-apt as an apt stage-package instead of compiling from source. Removed requirements-noble.txt and updated snapcraft configuration.
qwen/qwen3.6-35b-a3b — — Merged. Fixes snap build failures caused by uv rejecting non-PEP 625-compliant python-apt source tarballs. Replaces source compilation with an apt stage-package installation, removing requirements-noble.txt and build dependencies. CI passed.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 15
Confidence: 80
needs review Fixes snap build failure by installing python3-apt as an apt stage-package instead of building from source, bypassing uv's PEP 625 restriction. Currently approved by 2 reviewers but marked as draft pending full spread test suite results.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 15
Confidence: 85
keep open Fixes snap build failure caused by uv rejecting non-PEP 625 compliant source tarballs by installing python3-apt as an apt stage-package instead of building from source. Currently in draft pending spread test results.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 15
Confidence: 90
keep open Replaces building python3-apt from source with an apt stage-package to bypass uv's PEP 625 filename restriction. Currently marked draft pending full spread test suite completion.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 20
Confidence: 85
keep open Switches snap build to install python3-apt as an apt stage-package instead of building from source via uv, fixing a PEP 625 filename rejection error. Currently marked draft pending CI and review.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 40
Confidence: 85
keep open Fixes snap build failure caused by uv rejecting non-PEP 625 compliant python-apt source tarballs by installing python3-apt as an apt stage-package instead of building from source. Currently marked as draft pending full test suite results.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 30
Confidence: 85
keep open Replaces python-apt source build with apt stage-package to resolve uv PEP 625 compliance failure. Currently draft, awaiting full test suite results and maintainer review.
qwen/qwen3.6-35b-a3b
Staleness: 0
Complexity: 30
Confidence: 90
keep open Fixes snap build failure caused by uv rejecting python-apt source tarballs by installing python3-apt as an apt stage-package instead of building from source. Currently marked as draft pending completion of the spread test suite.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 45
Confidence: 85
keep open Changes snapcraft.yaml to install python3-apt as an apt stage-package instead of building from source via uv, fixing PEP 625 compliance failures. Currently marked as draft pending CI spread suite results.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 35
Confidence: 85
keep open Fixes snap build failure by installing python3-apt as an apt stage-package instead of building from source via uv. Currently marked as draft pending full test suite results.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 15
Confidence: 85
keep open Switches snap build to install python3-apt as an apt stage-package instead of building from source, resolving uv PEP 625 compliance failures. Currently marked as draft pending full test suite.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 15
Confidence: 90
keep open Fixes snap build failure caused by uv rejecting python-apt source tarballs by installing python3-apt as an apt stage-package instead of building from source. Currently marked draft pending CI spread suite.

Update history

Date Change
updated
updated
updated
updated
updated
updated
updated
updated
updated
created

Related work

  • Related To: canonical/charmcraft#1369 (confidence 70%)

    Referenced in the PR body as the reason the snap forces source builds (PIP_NO_BINARY/UV_NO_BINARY), which is why prebuilt python-apt wheels could not be used instead.

Related issues

Issue Project State Summary Similarity
#2850 fix(snap): install python3-apt as a stage-package instead of building… charmcraft merged Merged PR #2850 as commit e6edb4c6, replacing the incompatible python-apt source build with a dedicated python3-apt stage-package for snap builds.
85%
#401 fix(snap): install python3-apt as a stage-package instead of building from source imagecraft closed Closed unmerged. Copilot's port of charmcraft#2818 (python3-apt as a stage-package instead of a rejected .tar.xz source build) was dismissed by @lengau as "not enough of a change to bother"; no code landed in imagecraft.
82%
#6382 fix(snap): remove libapt-pkg-dev and stale comment now that python3-apt is a stage-package snapcraft closed Merged canonical/snapcraft#6382, removing obsolete libapt-pkg-dev from snap build dependencies and correcting the stale python-apt source-build comment.
79%
#6383 fix(snap): remove libapt-pkg-dev now that python3-apt is a stage-package snapcraft closed PR #6383 was merged, dropping the redundant libapt-pkg-dev build-package from snap/snapcraft.yaml now that python3-apt is installed via stage-packages, and refreshing the stale MAKEOPTS comment.
78%
#1321 chore(snap): remove libapt-pkg-dev since we no longer build python-apt rockcraft open Draft PR removing obsolete libapt-pkg-dev from snap/snapcraft.yaml; replicates charmcraft#2818. CI: 16 pass, lint/files and source-spread-tests fail; awaiting spread-test resolution per maintainer comment.
71%