Craft Store
raw JSON → 3.3.0 verified Fri May 01 auth: no python
Store bindings for Snaps and Charms, part of the Canonical craft tools ecosystem. Provides programmatic access to the Snap Store and Charmhub. Current version 3.3.0, requires Python >=3.10, actively maintained.
pip install craft-store Common errors
error ImportError: cannot import name 'StoreClient' from 'craft_store' ↓
cause Using wrong import path from older version or missing install.
fix
Use 'from craft_store import StoreClient'. Ensure you have at least version 3.0.0 and Python >=3.10.
error pydantic.errors.PydanticUserError: `model_dump` is not available in Pydantic v1 ↓
cause Code uses Pydantic v2 methods but craft-store 2.x uses Pydantic v1.
fix
If using craft-store <3.0.0, use .dict() instead of .model_dump(). For >=3.0.0, ensure your code is compatible with Pydantic v2.
error KeyringLocked: The keyring is locked. ↓
cause Keyring daemon is locked or inaccessible (e.g., GNOME Keyring without session).
fix
Unlock the keyring or use environment variable CRAFT_STORE_TOKEN to avoid keyring.
Warnings
breaking Minimum Python version changed to 3.10 in 3.0.0. ↓
fix Upgrade Python environment to 3.10 or above.
breaking Migrated from Pydantic v1 to v2 in 3.0.0, which may break serialization for custom models. ↓
fix Update any Pydantic v1 patterns (e.g., .dict() -> .model_dump()).
deprecated keyring v25.0 is known to be incompatible. ↓
fix Pin keyring to <25.0 or avoid using keyring-based credential storage.
Imports
- StoreClient wrong
from craft_store.client import StoreClientcorrectfrom craft_store import StoreClient - models wrong
from craft_store.models import ...correctfrom craft_store import models - errors
from craft_store import errors
Quickstart
from craft_store import StoreClient
client = StoreClient(base_url='https://api.snapcraft.io/v2/', application_name='my-app')
# Use client for store operations, e.g.:
# client.upload_snap('/path/to/snap.snap', 'my-snap', 'stable')
print('Client initialized')