groundhog-sdk package is the synchronous Python client for the Groundhog version 1 HTTP API.
Version 0.2 supports Unix sockets and HTTPS.
Each SDK operation maps to one public HTTP operation.
Groundhog remains responsible for durability, order, idempotency, and authoritative stream state.
The SDK does not provide local SQL or derived views.
Requirements
- Python 3.10 or newer
- A running Groundhog 0.2 service
- Access to its Unix socket or HTTPS endpoint
- Its bearer token when authentication is active
Installation
Install the 0.2 release from PyPI:groundhog-sdk.
Python code imports groundhog_sdk.
Connect through a Unix socket
unix:data/ground.sock.
Connect through HTTPS
Explicit transport settings
UseTransportConfig to keep the endpoint and timeout in one value:
Ground also reads GROUND_URL and GROUND_TOKEN.
Explicit arguments take precedence over environment variables.
Set these variables before you construct Ground(), then omit the matching arguments.
max_retries sets the number of attempts after the first request.
The default is 3.
The SDK retries connection failures and HTTP 429 responses.
Ingest also retries HTTP 503 responses with bounded exponential delays.
Build events
The event constructors produce the connector-owned fields:Ingest an atomic batch
send(source, events, batch_id) maps to POST /v1/events.
A batch contains 1 through 10,000 events and no more than 32 MiB.
The SDK encodes the complete batch once before its first attempt.
A retry sends identical bytes with the same (source, batch_id).
committedmeans the request durably appended the batch.duplicatemeans identical content already committed.IdempotencyConflictmeans the key identifies different committed content.
BatchReceipt.
Replay events
events() maps to one finite GET /v1/events request.
It returns full events in authoritative event_id order.
Filters use exact matches and after is exclusive.
Persist next_after for the next finite request.
EventPage contains:
The 0.2 SDK returns one finite page per call.
It does not provide a follow iterator or persistent cursor storage.
Use the HTTP API directly when a Python application needs continuous follow.
Enumerate streams
streams() maps to GET /v1/streams.
It returns typed Stream values in a StreamPage.
Each row reports authoritative state from the durable log.
It does not report a derived catalog snapshot.
For another page, use one anchored snapshot:
after requires the first page’s snapshot_through_event_id as through.
Build derived views
Groundhog stores and serves the durable event log. Applications build their own derived views from replay. A Python consumer normally applies each event and saves its event ID in the same database transaction. It can rebuild the view by replaying the log from the start. The SDK does not include a database adapter, SQL engine, or current-state model.Errors
All SDK exceptions derive fromGroundError.
Remote errors expose these attributes:
Use
code, not message, for program control.
The server can change descriptive text without changing its contract.
ValidationError.errors contains indexed event errors when the server provides them.
Local errors and responses from old servers can have code set to None.
Current 0.2 surface
The package exports:Ground.query(), Ground.catalog(), QueryResult, CatalogResult, SnapshotReceipt, and QueryError.
The package does not include follow, persistent cursors, async parity, connector management, or Groundhog process supervision.