Skip to content
Catalogd Publisher

snap-python

An async Python client for snapd and the Snap Store, wrapping the snapd REST API and the store's search API with httpx and Pydantic models.

By
Alexander Lukens
Publisher
alexdlukens
Updated
Nov 15, 2026
Slug
snap-python

No releases yet

This project does not have any published versions yet.

About snap-python

An async Python client for the snapd daemon and the Snap Store. It wraps the snapd REST API and the store's search API in an async HTTP client built on httpx, with Pydantic models for the responses.

Features

Every endpoint group is an attribute of SnapClient:

  • client.snaps — list, inspect, install, refresh, remove, hold, revert and switch channel on installed snaps, plus start/stop/restart apps
  • client.config — read and write a snap's configuration (snap get/snap set)
  • client.store — search the Snap Store, list categories, inspect store-side snap details and track/risk maps
  • client.changes — list, inspect, abort and watch changes, with shared waiters used by install, refresh, remove and configuration writes
  • client.interfaces — list interfaces and connections, connect or disconnect them
  • client.logs — read a bounded batch of service logs, or stream them as they are written

client.store talks to https://api.snapcraft.io directly; the other groups go through the snapd socket (/run/snapd.socket by default). Reading state needs no root privileges — installing, removing, configuring and connecting interfaces are forwarded to snapd, which asks for authorization where it requires it.

SnapdAPIError subclasses httpx.HTTPStatusError and carries the parsed snapd error envelope (kind and value), so callers can branch on snap-change-conflict, config-no-such-option, login-required and similar. An asyncio-native retry helper retries only transient failures and never non-idempotent methods.

Install

pip install snap-python

Quickstart

List the snaps installed on the local machine:

import asyncio

from snap_python.client import SnapClient


async def main() -> None:
    async with SnapClient() as client:
        response = await client.snaps.list_installed_snaps()
        for snap in response.result:
            # e.g. "firefox 128.0 stable"
            print(snap.name, snap.version, snap.tracking_channel)


asyncio.run(main())

Requirements

  • Python 3.10 or newer
  • httpx and Pydantic 2
  • Linux with snapd running for everything except store queries, with the snapd socket available at /run/snapd.socket

License

MIT.

Keywords

python snap snapd snapcraft api-client async httpx

Please confirm

Are you sure?