Skip to main content

beachcomber Python SDK

Python client for the beachcomber (comb) shell-state daemon.

Requirements

  • Python 3.9+
  • No external dependencies (stdlib ctypes binds directly to the native libbeachcomber.{so,dylib} — no subprocess, no socket code in this SDK)
  • A running comb daemon (or autostart left enabled, the default)
  • libbeachcomber.{so,dylib} discoverable — see "Library discovery" below

Installation

pip install beachcomber

Or with uv:

uv add beachcomber

Quick start

from beachcomber import Client

client = Client()

# Read a single field
result = client.get("git.branch", path="/path/to/repo")
if result.is_hit:
    print(result.data)    # "main"
    print(result.age_ms)  # 234
    print(result.stale)   # False

# Read a full provider (returns dict)
result = client.get("git", path="/path/to/repo")
if result.is_hit:
    print(result["branch"])  # "main"
    print(result["dirty"])   # False

# Force recomputation
client.refresh("git", path="/path/to/repo")

# Daemon status
status = client.status()

Sessions

For multiple queries use a session to reuse a single connection:

with client.session() as session:
    session.set_context("/path/to/repo")
    branch = session.get("git.branch")
    dirty = session.get("git.dirty")
    hostname = session.get("hostname")

Custom socket path

client = Client(socket_path="/tmp/beachcomber-1000/sock")

Library discovery

This SDK is a ctypes binding over libbeachcomber's C ABI — no socket code or wire-protocol framing lives in Python; the native library owns the connection (including the daemon socket's own auto-discovery and autostart). At import/first-use, the native library itself is located, in order:

  1. $BEACHCOMBER_LIB — exact path to the shared library.
  2. ../lib/<libname> relative to the comb binary resolved on $PATH.
  3. The platform default dynamic-linker search path.

If none resolve, LibraryDiscoveryError is raised naming every location tried — there is no silent fallback to spawning comb as a subprocess.

Socket discovery

Once the library is loaded, the daemon socket path itself is resolved by libbeachcomber (not this SDK): $BEACHCOMBER_SOCKET if set, else a stable per-user default. Pass Client(socket_path=...) to override it directly.

Exceptions

Every exception is a CombError subclass with a .kind attribute — a stable, machine-readable slug matching the C ABI envelope's error.kind (see libbeachcomber/exceptions.py), so callers should not need to string-match str(exc).

Exception .kind When raised
DaemonNotRunning daemon_not_running Daemon unreachable and autostart failed/disabled
ConnectionFailedError connection_failed An explicit socket_path couldn't be dialed
ServerError server_error Daemon returns ok: false for a request-level reason
ProtocolError io_error / parse_error / None I/O failure, malformed response, or bad envelope
TimeoutError timeout Operation timed out
BusyError busy A session/watch handle already in use by another caller
BadFlagsError bad_flags Unrecognised bit set in a get flags argument
VersionSkewError version_skew Daemon version doesn't match the loaded library's
PanicError panic The native library panicked
LibraryDiscoveryError library_discovery No candidate location yielded a loadable library
LibrarySymbolError library_symbol Loaded library is missing a required bc_* symbol
CombError varies Base class for all SDK errors

Metadata

Release files for libbeachcomber 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libbeachcomber 0.8.0
File Size Uploaded
libbeachcomber-0.8.0.tar.gz 22.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for libbeachcomber 0.8.0
File Interpreter ABI Platform
libbeachcomber-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.6 kB

Release files / libbeachcomber-0.8.0.tar.gz

Download URL libbeachcomber-0.8.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
56949c70ee30a3695b7639cb5585e4b1fbea70c4621b9cf30a2c4c7c9c0f8179
BLAKE2b-256 checksum
How to use checksums
434a36574f2b17d39755e1d8819b1adc8866400ad3c46e25053b3d1e3805d664
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release files / libbeachcomber-0.8.0-py3-none-any.whl

Download URL libbeachcomber-0.8.0-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d8a33963666c72fd5170f521c09f3c5d27355ce9e7cae14076b07d086e399fc
BLAKE2b-256 checksum
How to use checksums
c7b4d96b4fe0c2206f0d90084258a1be913248153a4a4f63791912b22f9425ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.1

2 release files

0.9.0

2 release files

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page