Skip to main content

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

Project description

beachcomber Python SDK

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

Requirements

  • Python 3.9+
  • No external dependencies (stdlib only)
  • A running comb daemon

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.poke("git", path="/path/to/repo")

# List available providers
providers = client.list()

# 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="/run/user/1000/beachcomber/sock")

Socket discovery

The SDK discovers the daemon socket at:

  1. $XDG_RUNTIME_DIR/beachcomber/sock
  2. $TMPDIR/beachcomber-<uid>/sock
  3. /tmp/beachcomber-<uid>/sock

Exceptions

Exception When raised
DaemonNotRunning Cannot connect to the socket
ServerError Daemon returns ok: false
ProtocolError Malformed JSON or I/O failure
CombError Base class for all SDK errors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libbeachcomber-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libbeachcomber-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file libbeachcomber-0.1.0.tar.gz.

File metadata

  • Download URL: libbeachcomber-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for libbeachcomber-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c6b9d5cd95ec603b31f1d7c9d4dcaad5062e6d00e25cb16b11be72e878e3405e
MD5 92524c0b61a743b99d26a2b81818fcf8
BLAKE2b-256 1e21ab0542af5c1b6aab947289df65f43a5d48ad5d65eefe8b6f6a9d3abe88cd

See more details on using hashes here.

File details

Details for the file libbeachcomber-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: libbeachcomber-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for libbeachcomber-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fba24aa75c0597ee6bb58c5bf058a4ba3204e3df275259589d4da942a701742e
MD5 42dafa12ebdc4d9cb8882743eb74c1f3
BLAKE2b-256 2bb84e5e9637237b7eeacbc4df07e7931b688aea69950b826f798da44e99c74e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page