Skip to main content

Python SDK for the Provenance platform — queue ingestion and full REST API client

Project description

STDIO Labs

Provenance SDK (Python)

Python SDK for the Provenance platform — queue-based ingestion and full async REST API client.

PyPI version License: MIT Python Version


Installation

pip install provenance-sdk

Quick Start

from provenance_sdk import create
import uuid

provenance = await create(api_key="your-api-key", origin="my-service")

# Queue-based ingestion
await provenance.log(
    resource_type="user",
    resource_id="user-123",
    action="login",
    uow_id=str(uuid.uuid4()),
    interaction={"email": "user@example.com"},
)

# REST API client
api = await provenance.api()
actions = await api.actions.list()
trace = await api.traces.get("user-123")

REST API Client

api = await provenance.api()

# CRUD
action = await api.actions.create({"title": "Deploy", "mnemonic": "DEPLOY"})
await api.actions.update(action["id"], {"title": "Deploy v2"})
await api.actions.delete(action["id"])

# Search & Analytics
results = await api.activity.search({"filters": {"action": "CREATE"}})
data = await api.analytics.query({
    "metrics": ["count"],
    "dimensions": ["action"],
    "timeRange": {"type": "relative", "value": "7d"},
})

# Auto-pagination
async for action in api.actions.list_all():
    print(action["title"])

Context Layering

scoped = provenance.add_context(resource_type="order", user_id="user-456")

await scoped.log(
    resource_id="order-789",
    action="create",
    uow_id=str(uuid.uuid4()),
    interaction={"total": 99.99},
)

Span Hierarchy

log() returns the generated spanId (a string). Pass it as parent_span_id to link child interactions:

parent_span_id = await provenance.log(
    resource_type="order",
    resource_id="order-789",
    action="create",
    uow_id=uow_id,
    interaction={"total": 99.99},
)

await provenance.log(
    resource_type="payment",
    resource_id="payment-456",
    action="process",
    uow_id=uow_id,
    parent_span_id=parent_span_id,
    interaction={"method": "card"},
)

You can also propagate parent_span_id via context:

child = provenance.add_context(parent_span_id=parent_span_id)
await child.log(resource_id="item-1", action="reserve", ...)

See the full docs for more details.

Configuration

Option Required Description
api_key Yes Your Provenance API key
origin Yes Name of the source system
platform_url No Platform URL (default: https://platform.provenance.dev)
api_url No Override API URL (resolved from platform by default)

Resilience

  • Lazy resolution — Config fetched on first use, not at create() time
  • Retry with backoff — 429/5xx retried up to 3× with exponential backoff
  • Auto-refresh — On 401/403, credentials force-refreshed and retried
  • 5-minute cache — Platform config cached per API key
  • Single dependency — Only requires httpx

License

Proprietary — STDIO Labs

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

provenance_sdk-1.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

provenance_sdk-1.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file provenance_sdk-1.1.0.tar.gz.

File metadata

  • Download URL: provenance_sdk-1.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for provenance_sdk-1.1.0.tar.gz
Algorithm Hash digest
SHA256 482cfdca1b0201d130f26f12dd09b2ce2b56c56ea6939e7599543deb3cfe9492
MD5 f3f968aaa44d9294df61f050b0609578
BLAKE2b-256 ea1ec85161614d05c9ceda09d4368d6dee69029a98aca5d45871a0ff6686d110

See more details on using hashes here.

Provenance

The following attestation bundles were made for provenance_sdk-1.1.0.tar.gz:

Publisher: publish-python.yml on stdiolabs/provenance_sdk_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file provenance_sdk-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: provenance_sdk-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for provenance_sdk-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11f488e661dcf39d03396dfdd0c1d6ae06f51630706b323a186ebd82ce999e82
MD5 ce0758cf41d78e463fcbd63cf984440f
BLAKE2b-256 175532c14ef4b06d36fb1c7dca88de24b45705d2e1a3bc960304800f81432374

See more details on using hashes here.

Provenance

The following attestation bundles were made for provenance_sdk-1.1.0-py3-none-any.whl:

Publisher: publish-python.yml on stdiolabs/provenance_sdk_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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