← Back to issue list

feat: use uv for 12-factor charms

View original Github issue

Metadata

Project
charmcraft
Number
#2714
Type
pull request
State
closed
Author
alithethird
Labels
Created
Updated
Closed

Current evaluation

Closed without merging. The proposed switch from the legacy charm plugin to the uv plugin for 12-factor extensions was abandoned due to failing CI checks on older Ubuntu bases and lint/security scans, with no reviewer engagement.

Suggested action:

No scores available.

Issue body

## Summary Switch the 12-factor app extensions (Flask, Django, FastAPI, Go, Spring Boot, and the shared `_AppBase`) from the `charm` plugin to the `uv` plugin for building Python charms. ## What changed **`charmcraft/extensions/app.py`** - `_AppBase._get_charm_part()` — replaces `plugin: charm` with `plugin: uv` and swaps `build-snaps: [rustup]` + the `override-build` rustup-init script for `build-snaps: [astral-uv, rustup]`. The `astral-uv` snap provides the `uv` tool that the `uv` plugin expects; `rustup` remains to satisfy pydantic compilation. - `_AppBase.get_supported_bases()` — now returns both `ubuntu@22.04` and `ubuntu@24.04`. Previously only 22.04 was listed, but the `charmcraft init` templates generate `base: ubuntu@24.04`. This caused CI to reject the extension with "does not support base(s): ubuntu@24.04" after PR #2713 made base validation strict. - `SpringBootFramework.is_experimental()` — adds an explicit `is_experimental` override that returns `False`, making it clear this extension is production-ready and consistent with the other frameworks. **`tests/extensions/test_app.py`** Updated all expected `charm` part fixtures to match the new `uv` plugin shape (no `override-build`, both snaps listed). ## Why The `uv` plugin is the recommended way to install Python dependencies in modern charms. It: - Reads `pyproject.toml` or `requirements.txt` and installs deps via `uv sync` / `uv pip install` - Is faster and more reproducible than pip-based installs done in `override-build` - Avoids the bespoke `rustup default stable && craftctl default` override-build script The `charm` plugin is a legacy build path. Switching to `uv` aligns 12-factor charms with the current recommended charm development workflow. ## Testing - Unit tests: `make test` (all 2539 pass) - Snap tests: covered by CI via `charmcraft init --profile django-framework` + `charmcraft fetch-libs` on Ubuntu 20.04 and 22.04 spread nodes ## Related - Depends on PR #2713 (`feat(extensions): make extensions work with base`) which is now merged to main. - Trivy security scan failure (Django 5.1.4 in `docs/tutorial/code/django/requirements.txt`) is pre-existing and unrelated to this change. --- - [x] I've followed the [contribution guidelines](https://github.com/canonical/charmcraft/blob/main/CONTRIBUTING.md). - [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/). - [x] I've successfully run `make lint && make test`. - [x] I've added or updated any relevant documentation. - [ ] In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing. - [ ] I've updated the relevant release notes.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Closed without merging. The proposed switch from the legacy charm plugin to the uv plugin for 12-factor extensions was abandoned due to failing CI checks on older Ubuntu bases and lint/security scans, with no reviewer engagement.
qwen3.6-35b-a3b-mtp-q6 Merged. Switched 12-factor charm extensions from the legacy charm plugin to the uv plugin for faster Python dependency management. Added Ubuntu 24.04 base support, fixed the SpringBoot experimental flag, and updated test fixtures.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2050 feat: add uv plugin to charmcraft charmcraft merged Merged pull request adding a uv plugin to charmcraft. Approved by three reviewers and contingent on craft-parts PR #945. Successfully closes issue #2040 and modifies 18 files to implement the feature.
73%