← Back to issue list

12-factor plugin installs unnecessary package into charm's venv

View original Github issue

Metadata

Project
charmcraft
Number
#2652
Type
issue
State
open
Author
dimaqq
Labels
Created
Updated
Closed

Current evaluation

12-factor (fastapi-framework) charm builds include extra packages in the venv (packaging, setuptools, wheel, dnspython, email_validator, idna) beyond requirements.txt; untriaged, no maintainer response, 136 days old.

Suggested action: needs triage

Reason: No labels, no assignee, and zero comments/maintainer interaction in 136 days, so it has not been assessed. The report is a concrete, reproducible bug with a diff of the extra venv packages, and the PythonPlugin in charmcraft/parts/plugins/_python.py (pip install --no-deps plus PIP_NO_BINARY) is the likely area to investigate, so it should be triaged rather than closed.

Impact: 45 Quick Win: 20.25 Staleness: 70 Complexity: 55 Confidence: 70 Support Request: 10

Issue body

### Check existing issues - [x] I've verified that this bug isn't described by any existing issues. ### Bug description Building a 12-factor charm (fastapi in this case), results in a larger venv than necessary. My gut feeling is that the build dependencies are left in the venv, though some other deps are also there, which are not trivial to categorise. ### Steps to reproduce ### Charm `charmcraft pack` this charm: https://github.com/canonical/roadmap.canonical.com/tree/main/charm (or `juju download canonical-roadmap --channel latest/edge`) unpack the charm `ls venv/| sort > from-charmcraft-pack` ### What's required Observe that https://github.com/canonical/roadmap.canonical.com/blob/main/charm/pyproject.toml doesn't list dependencies Only https://github.com/canonical/roadmap.canonical.com/blob/main/charm/requirements.txt does Create a new venv: `python3.12 -m venv test-paas` and activate Install the deps: `pip install -r requirements.txt` See what got installed: `ls test-paas/lib/python3.12/site-packages/| sort > from-paas-charm` ### Compare the two files: ```diff (test-paas) ⋊> dima@bb ⋊> ~/tmp-rdm diff from-paas-charm from-charmcraft-pack 08:58:17 7c7,15 < cosl-1.9.1.dist-info --- > cosl-1.6.1.dist-info > _distutils_hack > distutils-precedence.pth > dns > dnspython-2.8.0.dist-info > email_validator > email_validator-2.3.0.dist-info > idna > idna-3.11.dist-info 19c27 < opentelemetry_api-1.41.0.dist-info --- > opentelemetry_api-1.40.0.dist-info 24c32,34 < paas_charm-1.11.1.dist-info --- > paas_charm-1.11.0.dist-info > packaging > packaging-26.0.dist-info 26c36 < pip-24.0.dist-info --- > pip-24.1.1.dist-info 36a47,48 > setuptools > setuptools-82.0.1.dist-info 44a57,58 > wheel > wheel-0.46.3.dist-info 48c62 < zipp-3.23.1.dist-info --- > zipp-3.23.0.dist-info ``` There are two groups of extra deps: - `packaging, setuptools, wheel` which appear to be build dependencies - `_distutils_hack, distutils-precendence` which may also be - `dns, dns_python, email_validator, idna` I guess `pydantic`'s extra? ### Environment regular charmcraft pack ### charmcraft.yaml ```yaml name: canonical-roadmap type: charm base: ubuntu@24.04 # the platforms this charm should be built on and run on. # you can check your architecture with `dpkg --print-architecture` platforms: amd64: # arm64: # ppc64el: # s390x: summary: FastAPI web service of roadmap.canonical.com description: | Read more about the project on https://github.com/canonical/roadmap.canonical.com extensions: - fastapi-framework requires: postgresql: interface: postgresql_client optional: false limit: 1 config: options: jira-url: description: | The base URL of the Jira instance. default: "https://xxx.atlassian.net" type: string jira-username: description: | The username (email) used to authenticate with Jira. type: string jira-pat: description: | The Jira Personal Access Token used for authentication. type: string jql-filter: description: | Additional JQL filter appended to the dynamically built query. Cycle labels are derived automatically from registered cycles in the database — do NOT include "labels in (...)" here. default: "issuetype = Epic" type: string oidc-client-id: description: | The OIDC client ID for authenticating users. Leave empty to disable authentication. type: string oidc-client-secret: description: | The OIDC client secret. type: string oidc-issuer: description: | The OIDC issuer URL. Used for OpenID Connect discovery. default: "https://iam.green.canonical.com" type: string oidc-redirect-uri: description: | The full callback URL for the OIDC redirect (e.g. https://roadmap.canonical.com/callback). type: string session-secret: description: | Secret key used to sign the session cookie. Must be set to a stable random value for multi-replica deployments. type: string sync-interval-seconds: description: | Interval (in seconds) between automatic Jira syncs. Set to 0 to disable the periodic sync entirely. default: 3600 type: int ``` ### Log output ```shell N/A ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 20.25
Staleness: 70
Complexity: 55
Confidence: 70
Support Request: 10
needs triage 12-factor (fastapi-framework) charm builds include extra packages in the venv (packaging, setuptools, wheel, dnspython, email_validator, idna) beyond requirements.txt; untriaged, no maintainer response, 136 days old.
qwen3.6-35b-a3b-mtp-q6
Staleness: 60
Complexity: 45
Confidence: 85
Support Request: 10
needs triage 12-factor charmcraft plugin installs build dependencies and extras into the charm's venv during pack, resulting in a larger environment than necessary. Currently untriaged and inactive for 98 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 45
Confidence: 90
Support Request: 15
needs triage charmcraft 12-factor plugin includes unnecessary build dependencies and extras in the charm venv, increasing size. Unlabelled with no maintainer response after 84 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 40
Confidence: 90
Support Request: 10
needs triage 12-factor charmcraft plugin installs build dependencies and extras into the charm's venv, making it larger than necessary. Untriaged with no maintainer response after 81 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 40
Confidence: 80
Support Request: 10
needs triage 12-factor plugin leaves build dependencies and extras in the charm virtual environment, creating an unnecessarily large venv. Open 62 days with zero comments, awaiting triage.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.