charmcraftcache
Reinventing the wheel
Fast first-time builds for charmcraft—on a local machine or CI
Installation
Install pipx: https://pipx.pypa.io/stable/installation/
pipx install charmcraftcache
Usage
For best results, use charmcraft's Poetry plugin or add charm-strict-dependencies: true to your charmcraft.yaml.
Step 1: Update charmcraft.yaml to supported syntax
Only "multi-base shorthand notation" syntax is supported
Example
platforms:
ubuntu@22.04:amd64:
ubuntu@22.04:arm64:
ubuntu@24.04:amd64:
ubuntu@24.04:arm64:
Under the charmcraft.yaml platforms key, build-on and build-for syntax are not supported
The base and bases charmcraft.yaml keys are not supported
Step 2: Add your charm to the cache
ccc add
Step 3: Pack your charm
ccc pack
How it works
Why are charmcraft builds slow?
Instead of downloading wheels from PyPI (which pip does by default), charmcraft builds Python package wheels from source (i.e. with pip install --no-binary).
Caching mechanism
charmcraft builds each charm platform in a separate LXC container1. Within each container, pip has an internal cache for wheels built from source & for HTTP responses.
charmcraft 2.5 moved the pip internal cache to the LXC host machine, so that one pip cache is used for all LXC containers. (This increases the chance of a cache hit—a faster build.)
However, charmcraft builds are still slow the first time the wheel is built. This happens on CI runners, when you use a new machine/VM, or when you contribute to a new charm.
charmcraftcache solves the slow first build.
charmcraftcache-hub maintains a list of charms. For each charm, charmcraft pack is used to build Python dependencies from source and the pip wheel cache is uploaded to a GitHub release.
ccc pack downloads these pre-built wheels to charmcraft's pip cache (and then runs charmcraft pack).
Note: Within the GitHub release, each charm has an isolated cache. If the same charm (same GitHub repository and relative path to charmcraft.yaml) is added to the list of charms more than once (with different git refs), the wheels are combined into a single cache. If there are duplicate wheels, the wheel is selected from the ref that is earlier in the list.
Isn't this just a worse version of PyPI?
Pretty much. The only difference is charmcraftcache-hub wheels are built from source on our runners, instead of built by the package maintainer.
Why does charmcraftcache only support "shorthand notation" syntax in charmcraft.yaml platforms?
"Shorthand notation" is used when build-on is identical to build-for. (For example, "ubuntu@22.04:amd64" means build on Ubuntu 22.04 amd64 and build for Ubuntu 22.04 amd64.)
For charms that depend (directly or indirectly) on Python packages with C extensions (e.g. pyyaml), charmcraft will build wheels where the C extensions only work on build-on.
For example, if a charm is built with
platforms:
foo:
build-on: ubuntu@22.04:amd64
build-for:
- ubuntu@22.04:amd64
- ubuntu@22.04:arm64
the wheels in the *.charm file will contain C extensions that only work on amd64, not arm64.
The vast majority of charms have at least one Python dependency with C extensions, so the vast majority of charms should use "shorthand notation".
-
Unless
--destructive-modeis enabled ↩
Metadata
Release files for charmcraftcache 0.8.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| charmcraftcache-0.8.5.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| charmcraftcache-0.8.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.5 kB
Release files / charmcraftcache-0.8.5.tar.gz
| Download URL | charmcraftcache-0.8.5.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
973a4b6f9af946798dde99daded851f3345e37a118f318668bae5b1ddfdd5c47
|
|
BLAKE2b-256 checksum How to use checksums |
5250040dfe793e5f35fcdcfc88f10521e65a98f678a38b7aa22b7dfb1806aa46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.
Transparency logRelease files / charmcraftcache-0.8.5-py3-none-any.whl
| Download URL | charmcraftcache-0.8.5-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
704409349ea8a77b32c8039bdf9c1629d5177dfab3fb66becf34b97efcd1ac30
|
|
BLAKE2b-256 checksum How to use checksums |
52d39d810c101eebb9916a4b9ea48d2f00f0f8d8e6cafe1b2a40143fd699d2fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.
Transparency log