Skip to main content

Fast first-time builds for charmcraft

Project description

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

ccc add
ccc pack

For best results, add charm-strict-dependencies: true to your charmcraft.yaml.

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 base in a separate LXC container[^1]. 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.

[^1]: Unless --destructive-mode is enabled

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

charmcraftcache-0.5.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

charmcraftcache-0.5.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file charmcraftcache-0.5.0.tar.gz.

File metadata

  • Download URL: charmcraftcache-0.5.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for charmcraftcache-0.5.0.tar.gz
Algorithm Hash digest
SHA256 853b718ddbe846c5e6460582b5cb79e12fb7b031414878ace1cc76ffff8537df
MD5 df2ff838df0a76d25855d1890562a27e
BLAKE2b-256 568f96509fd853b2997e377cf73dd8df92f9d5c6251e9828aaf68eb11d28237d

See more details on using hashes here.

Provenance

The following attestation bundles were made for charmcraftcache-0.5.0.tar.gz:

Publisher: publish.yaml on canonical/charmcraftcache

Attestations:

File details

Details for the file charmcraftcache-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for charmcraftcache-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 457c020a7ed51378a1b892171fed6bf938821c288501974bf0271a3c03e597be
MD5 f58ca5ee730326487f58e16944063d41
BLAKE2b-256 a8e04884e6531c852e559e779afbaebba16b82969f0882820184859506990d60

See more details on using hashes here.

Provenance

The following attestation bundles were made for charmcraftcache-0.5.0-py3-none-any.whl:

Publisher: publish.yaml on canonical/charmcraftcache

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page