Skip to main content

probate-client (Python)

A small typed client for the Probate Courthouse public API, with sync and async versions. It depends only on httpx. Python 3.11+.

pip install probate-client

Use

from probate_client import ApiError, ProbateClient

with ProbateClient("https://your-courthouse.example") as probate:
    summary = probate.summary()
    print(summary["living"], summary["counts"]["instincts"])

    for case in probate.latest_trial()["cases"]:
        print(case["n"], case["verdict"], case["text"])

    try:
        print(probate.ask(3, "What would you warn the next one about?")["answer"])
    except ApiError as e:
        print(e.status, e.message)  # 400 "not_dead", 429 "rate_limited", ...

    for event in probate.events(interval=5):  # polls; break to stop
        print(event["ts"], event["kind"], event["text"])

Async:

import asyncio
from probate_client import AsyncProbateClient

async def main():
    async with AsyncProbateClient("http://localhost:8080") as probate:
        print(await probate.health())
        async for event in probate.events():
            print(event["text"])

asyncio.run(main())

API

Method Route
summary() GET /api/summary
generation(n) GET /api/generations/{n}
trial(n) GET /api/trials/{n}
latest_trial() GET /api/trials/latest
genome() / instincts() GET /api/genome (instincts() returns just the list)
evidence() GET /api/evidence
health() GET /healthz
ask(gen, question) POST /api/generations/{n}/ask
events(since=0, interval=5.0) GET /api/events?since= (iterator)

ProbateClient(base_url="http://localhost:8080", *, api_key=None, timeout=30.0, http_client=None), and the same for AsyncProbateClient (use await client.aclose() or async with). Errors from the server raise ApiError with status, message and body. Network errors and timeouts raise the httpx exceptions unchanged. Nothing is retried.

Responses are plain dicts. probate_client.types has TypedDict definitions for them, so editors and mypy know the keys.

Honest limits

  • events() polls. The Courthouse serves /api/events as a JSON list (newest 50 rows, ?since=<id>), not as server-sent events. If more than 50 events arrive between polls, the older ones are missed.
  • api_key does nothing yet. It is sent as X-Probate-Key, reserved for a future judge key; the Courthouse does not read it today.
  • No runtime validation. The TypedDicts are hand-written from services/core/probate/courthouse/views.py and checked in the tests against a fake-mode Courthouse (12 simulated generations, missing and extra keys both fail). A server change that the tests do not cover can still drift.
  • ask only works on dead generations and is limited to 10 questions a minute per IP.
  • No retries, no pagination helpers, no caching.

Develop

pip install -e services/core            # the Courthouse the tests run against
pip install -e 'packages/client-py[dev]'
ruff check packages/client-py
pytest packages/client-py

MIT licensed.

Metadata

Release files for probate-client 0.1.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 probate-client 0.1.0
File Size Uploaded Provenance Actions
probate_client-0.1.0.tar.gz 10.5 kB Without provenance Details for probate_client-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for probate-client 0.1.0
File Interpreter ABI Platform Actions
probate_client-0.1.0-py3-none-any.whl Python 3 none any Details for probate_client-0.1.0-py3-none-any.whl

Total release size: 18.4 kB

Release files / probate_client-0.1.0.tar.gz

Download URL probate_client-0.1.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1b891775a969966278db150181a87d8bbae84cb6c8e00de9ff02112694ce370d
BLAKE2b-256 checksum
How to use checksums
40fc4a9cea2db93e8e31a524568c1fe108c0459c9bafba5a153a78c43c73cb65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / probate_client-0.1.0-py3-none-any.whl

Download URL probate_client-0.1.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c54fbdf72599aae7d4dfa5d2ee706e8425908e163f774dc84aa09c17f21f5d4b
BLAKE2b-256 checksum
How to use checksums
b73dc4f34c822c3b0da86a49756a08a733aa6efdd9125c2eb4492e63e256b275
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for probate-client 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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