Skip to main content

Typed HTTP client for the Turbine management API

Project description

turbine-client

Typed HTTP client for the Turbine management API. Sync and async siblings; both speak the /api/v1/manage/... surface and accept any httpx.Auth strategy.

Use this when you want to call a running Turbine server from your own code — outside of a dagster-turbine or airflow-turbine integration.

Install

uv add turbine-client

Python 3.12 or newer.

Minimal example

from turbine_client import TurbineClient

client = TurbineClient("http://turbine:8000")
contracts = client.list_contracts()           # list every registered contract
sessions = client.start_runs(["orders"])      # fan out one Check Run per contract id
result = sessions[0].wait()                   # block until the run is terminal
print(result.status, [r.outcome for r in result.results])

Contract selection

start_runs accepts three shapes:

  • start_runs("orders") — single contract, one run.
  • start_runs(["orders", "customers"]) — explicit list, one run per id.
  • start_runs(None) (the default) — fan out across every registered contract.

start_run(contract_id) is the atomic primitive — one contract, one run handle.

Check Window and run options

start_runs (and start_run) accept four optional kwargs:

kwarg type purpose
since datetime | str | None lower bound of the Check Window
until datetime | str | None upper bound of the Check Window
incremental bool scope to rows newer than the last run's watermark — mutually exclusive with since / until server-side
flag_rows bool persist failing-row primary keys to the flag matrix

Auth

Pass any httpx.Auth subclass via the auth= kwarg. Two helpers ship with the package:

from turbine_client import TurbineClient, BearerAuth, AzureADClientCredentials

client = TurbineClient("http://turbine:8000", auth=BearerAuth(token="..."))

# OAuth client-credentials (e.g. behind the PAX ingress gateway):
client = TurbineClient(
    "https://turbine.example.com",
    auth=AzureADClientCredentials(
        tenant_id="...", client_id="...", client_secret="...",
        scope="api://turbine/.default",
    ),
)

Leave auth=None for in-cluster, unauthenticated deployments.

Async client

AsyncTurbineClient mirrors TurbineClient; every network method returns a coroutine. Use it from any asyncio event loop — including the Airflow triggerer process.

from turbine_client import AsyncTurbineClient

async def main() -> None:
    client = AsyncTurbineClient("http://turbine:8000")
    sessions = await client.start_runs(["orders"])
    result = await sessions[0].wait()

Compatibility

turbine-client >= 0.5.12 requires turbine-data >= 0.5.12 on the server (Contract Selection + Check Severity round-trip require both the POST /checks/runs endpoint and the severity field on the registry response). The client carries no runtime version negotiation; older clients keep working against newer servers because API additions are additive on /api/v1.

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

turbine_api_client-0.5.13.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

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

turbine_api_client-0.5.13-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file turbine_api_client-0.5.13.tar.gz.

File metadata

  • Download URL: turbine_api_client-0.5.13.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for turbine_api_client-0.5.13.tar.gz
Algorithm Hash digest
SHA256 a7212e320930bd9caafc2e4b8250798b172c389efb93233ed806b3cf396f766b
MD5 ef5bcd069ab6047b27dace0cff21a06e
BLAKE2b-256 8c0e06b8dbd5cb94ef32448f47faa60d19d44875f3d81f3eeff47ced78d669cf

See more details on using hashes here.

File details

Details for the file turbine_api_client-0.5.13-py3-none-any.whl.

File metadata

  • Download URL: turbine_api_client-0.5.13-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for turbine_api_client-0.5.13-py3-none-any.whl
Algorithm Hash digest
SHA256 75fcd0433ad8d7d5f684c8efaae9a4f4868ee789d1103ae1e490803ce48b709a
MD5 f9b265e56d6590f335d3b6d6b8115e39
BLAKE2b-256 6695629b39df9122cee4b9865c658be961d89539312f461b652a351810d72d6f

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