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.2.0.tar.gz (17.1 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.2.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: provenance_sdk-1.2.0.tar.gz
  • Upload date:
  • Size: 17.1 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.2.0.tar.gz
Algorithm Hash digest
SHA256 63d1d13571f902f0e288e3712c29f8dfd1c217b8dd57d03072faf996974af11b
MD5 60530ab435611b662152f8ec006020d4
BLAKE2b-256 28fb615d3c976a2cfffe87a9047319650293fc8840b9b25dee651cb3349d8a08

See more details on using hashes here.

Provenance

The following attestation bundles were made for provenance_sdk-1.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: provenance_sdk-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b92be43ebcc6a903b183b3eb15920e1938341355b4e70483086e7100fb07ea0
MD5 fbebd244e1d834f6f342e73cba62f3f7
BLAKE2b-256 daf90b3ca11bca5c7c33b9aa52b58d85d50507a9ca4d314c40cc3e1a34b15799

See more details on using hashes here.

Provenance

The following attestation bundles were made for provenance_sdk-1.2.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