Python SDK for cloacina-server — typed REST client and WebSocket execution-event streams. Version-locked to the cloacina server release. (Service client; the embedded runtime is the separate `cloaca` package.)
Project description
cloacina-client
Python SDK for cloacina-server — a typed REST client plus WebSocket execution-event streaming, for Python 3.10+.
This is the service client. It talks to a running cloacina-server over HTTP/WebSocket. The embedded workflow runtime is the separate
cloacapackage — the two are deliberately distinct.
Version lockstep: cloacina-client X.Y.Z is generated from, tested against, and only supported on cloacina-server X.Y.Z.
Install
pip install cloacina-client
Quickstart
from cloacina_client import Client
client = Client("http://localhost:8080", api_key="clk_...", tenant="public")
accepted = client.execute_workflow("my_workflow", {"input": 42})
print(accepted.execution_id)
for execution in client.iterate_executions(status="Failed"):
print(execution.id, execution.workflow_name)
Every helper raises CloacinaApiError (with .status and the server's machine-readable .code) on non-2xx responses. The generated openapi-python-client client is available as client.generated for anything the shim doesn't cover.
Async + live execution events
import asyncio
from cloacina_client import AsyncClient
async def main():
client = AsyncClient("http://localhost:8080", api_key="clk_...")
accepted = await client.execute_workflow("my_workflow", {"input": 42})
# Reconnect, dedup, and acks are handled for you.
async for event in client.follow_execution_events(accepted.execution_id):
print(event)
asyncio.run(main())
WebSocket connections never carry the long-lived key: the SDK mints a single-use, 60-second ticket (POST /v1/auth/ws-ticket) per connection. A 4426 close (protocol version mismatch) raises ProtocolVersionError — upgrade the SDK.
Regenerating
src/cloacina_client/_generated/ is produced by a pinned generator from the committed server contract:
uvx openapi-python-client@0.29.0 generate \
--path ../../docs/static/openapi.json \
--config generator-config.yaml --meta none \
--output-path src/cloacina_client/_generated --overwrite
Contract tests
tests/test_contract.py exercises every documented endpoint plus the WebSocket lifecycle against a live server:
CLOACINA_SERVER_URL=http://localhost:8080 \
CLOACINA_API_KEY=<bootstrap-key> \
uv run pytest
The full execute→event-stream flow (which needs a compiled .cloacina package) runs in the repo's angreal test sdk-contract harness.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloacina_client-0.8.0.tar.gz.
File metadata
- Download URL: cloacina_client-0.8.0.tar.gz
- Upload date:
- Size: 47.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99c96b6fdc8dcf69462938cfabd964c761aaec4ed3b21bd267c6ffbd2523f35c
|
|
| MD5 |
3692eef2a71d8f06aa65416e87c903c9
|
|
| BLAKE2b-256 |
dcc36c60c0a90b2bbe0f1ae267a5553e35fdace0da4f007330aed0247e59c21f
|
File details
Details for the file cloacina_client-0.8.0-py3-none-any.whl.
File metadata
- Download URL: cloacina_client-0.8.0-py3-none-any.whl
- Upload date:
- Size: 92.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a12fbf193c09b780dab2333e277c843470149b45b711cbdb961bc4fe225c924b
|
|
| MD5 |
c35cbe01e9b36175b031d91772668dc4
|
|
| BLAKE2b-256 |
21dbf80957ec08e5ea91a5c55dd4bce71f98494aeb1948f5f1761185b38a740f
|