Registry / devops / craft-providers

craft-providers

JSON →
library3.6.0pypypi✓ verified 85d ago

Craft-providers is a Python library for managing and provisioning build environments using LXD, Multipass, or Docker. It is part of the Snapcraft ecosystem, currently at version 3.6.0, with a release cadence of approximately monthly.

pip install craft-providers
INSTALL
IMPORT
SIG · CRAFT-PROVIDERS
C
craft-providers
devopspythonv3.6.0
Install
4.5s avg
Import
1410ms
Disk
49MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.464s · 53.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.5s · import 1.356s · 54MB
49MB installed
● package 49MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LXDInstance
from craft_providers.lxd import LXDInstance
Correct import for LXD provider instance.
MultipassInstance
from craft_providers.multipass import MultipassInstance
Correct import for Multipass provider instance.
DockerInstance
from craft_providers.docker import DockerInstance
from craft_providers.docker import Docker
The class is named DockerInstance, not Docker.

Creates an LXD container with Ubuntu Jammy, runs a command, then deletes it.

from craft_providers.lxd import LXDInstance from craft_providers import bases instance = LXDInstance(name="my-instance") instance.create( base=bases.BuilddBase(series="jammy") ) with instance as ctx: print(ctx.execute_run(["lsb_release", "-a"])) instance.delete()
Debug
Known issues
breakingIn craft-providers 2.0, the API was rewritten. The old craft_providers.bases.Base class hierarchy was replaced with craft_providers.bases.BuilddBase and other concrete base classes.
fix
Update code to use new base classes; refer to migration guide.
affects: <2.0
deprecatedcraft_providers.lxd.LXDInstance.launch() is deprecated in favor of .create() since version 3.0.
fix
Use .create() instead of .launch().
affects: >=3.0
gotchaLXD must be installed and the user must have permission to interact with the LXD socket (usually via lxd group).
fix
Install LXD and add user to lxd group, then log out and back in.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'LXDInstance' from 'craft_providers'
The LXDInstance class is not directly under craft_providers; it is in craft_providers.lxd.
fix
Use: from craft_providers.lxd import LXDInstance
craft_providers.errors.ProviderError: Failed to launch LXD container
LXD is not installed, not running, or the user lacks permissions.
fix
Ensure LXD is installed, the daemon is running, and user is in the lxd group.
Upgrade
Version history
3.6.0latest on PyPI · released Apr 30, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Resources
craft-providers — pip install craft-providers · libregistry