{"id":23466,"library":"craft-providers","title":"Craft Providers","description":"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.","status":"active","version":"3.6.0","language":"python","source_language":"en","source_url":"https://github.com/canonical/craft-providers","tags":["build","container","lxd","multipass","docker","snapcraft"],"install":[{"cmd":"pip install craft-providers","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Correct import for LXD provider instance.","wrong":"","symbol":"LXDInstance","correct":"from craft_providers.lxd import LXDInstance"},{"note":"Correct import for Multipass provider instance.","wrong":"","symbol":"MultipassInstance","correct":"from craft_providers.multipass import MultipassInstance"},{"note":"The class is named DockerInstance, not Docker.","wrong":"from craft_providers.docker import Docker","symbol":"DockerInstance","correct":"from craft_providers.docker import DockerInstance"}],"quickstart":{"code":"from craft_providers.lxd import LXDInstance\nfrom craft_providers import bases\n\ninstance = LXDInstance(name=\"my-instance\")\ninstance.create(\n    base=bases.BuilddBase(series=\"jammy\")\n)\nwith instance as ctx:\n    print(ctx.execute_run([\"lsb_release\", \"-a\"]))\ninstance.delete()","lang":"python","description":"Creates an LXD container with Ubuntu Jammy, runs a command, then deletes it."},"warnings":[{"fix":"Update code to use new base classes; refer to migration guide.","message":"In 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.","severity":"breaking","affected_versions":"<2.0"},{"fix":"Use .create() instead of .launch().","message":"craft_providers.lxd.LXDInstance.launch() is deprecated in favor of .create() since version 3.0.","severity":"deprecated","affected_versions":">=3.0"},{"fix":"Install LXD and add user to lxd group, then log out and back in.","message":"LXD must be installed and the user must have permission to interact with the LXD socket (usually via lxd group).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'3.6.0':31 'approxim':37 'build':14,39 'cadenc':35 'contain':40 'craft':1,4 'craft-provid':3 'current':28 'docker':20,43 'ecosystem':27 'environ':15 'librari':9 'lxd':17,41 'manag':11 'month':38 'multipass':18,42 'part':23 'provid':2,5 'provis':13 'python':8 'releas':34 'snapcraft':26,44 'use':16 'version':30","created_at":"2026-05-01T08:07:55.450780+00:00","updated_at":"2026-05-01T08:07:55.450780+00:00","problems":[{"fix":"Use: from craft_providers.lxd import LXDInstance","cause":"The LXDInstance class is not directly under craft_providers; it is in craft_providers.lxd.","error":"ImportError: cannot import name 'LXDInstance' from 'craft_providers'"},{"fix":"Ensure LXD is installed, the daemon is running, and user is in the lxd group.","cause":"LXD is not installed, not running, or the user lacks permissions.","error":"craft_providers.errors.ProviderError: Failed to launch LXD container"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.6.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/craft-providers/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}