Skip to main content

Primitive Python client for Relivio deploy registration, ingest, and exception capture.

Project description

relivio

Primitive Python client for Relivio deploy registration, ingest, and exception capture.

PyPI · GitHub

Status

  • current package scope: 0.1.0
  • supported Python versions: 3.9+
  • current public surface:
    • deployments.register()
    • deployments.register_from_environment()
    • ingest.send()
    • ingest.asend()
    • ingest.send_batch()
    • capture_exception()
    • acapture_exception()
    • protection.get_status()
    • verdicts.latest()
    • status()
  • automatic retry only for 429 RATE_LIMITED

Non-goals

  • full verdict consumer surface
  • feedback/history/list/search APIs
  • guard or middleware implementation
  • broad auto instrumentation or metric collection
  • framework adapters
  • request object parsing

Installation

pip install relivio

Verify the installed package:

python -c "import relivio; print(relivio.__all__)"

For local development:

pip install -e ".[dev]"

Quick Start

from relivio import Relivio, IngestLogInput

relivio = Relivio(api_key="rk_...")

deployment = relivio.deployments.register()
print(deployment.id)

result = relivio.ingest.send(
    IngestLogInput(
        level="ERROR",
        message="checkout failed",
        api_path="/api/orders/finalize",
    )
)
print(result.log_event_id)

verdict = relivio.verdicts.latest()
if verdict is not None:
    print(verdict.verdict, verdict.decision_tier)

Capture exceptions explicitly from the boundary that already knows the safe path/context:

try:
    run_usecase()
except Exception as exc:
    relivio.capture_exception(
        exc,
        service="checkout-api",
        api_path="/api/orders/{id}",
        trace_id="req_123",
    )
    raise

Read protection status explicitly from guard code:

from relivio import ProtectionStatusInput

status = relivio.protection.get_status(
    ProtectionStatusInput(
        service="checkout-api",
        api_path="/api/orders/{id}",
        method="POST",
    )
)

print(status.decision_tier, status.matched_api_path)

Async Example

import asyncio
from relivio import Relivio, RegisterDeploymentInput

relivio = Relivio(api_key="rk_...")

async def main() -> None:
    deployment = await relivio.deployments.aregister(
        RegisterDeploymentInput(version="1.2.3")
    )
    print(deployment.id)

    try:
        await run_usecase()
    except Exception as exc:
        await relivio.acapture_exception(
            exc,
            service="checkout-api",
            api_path="/api/orders/{id}",
        )
        raise

asyncio.run(main())

Development

python -m venv .venv
./.venv/bin/pip install -e ".[dev]"
./.venv/bin/pytest
./.venv/bin/python -m build

Behavior Notes

  • API key is sent through X-API-Key
  • Idempotency-Key is supported for v0 writer endpoints
  • 429 responses are retried with Retry-After
  • 5xx responses are not retried
  • server can accept gzip payloads, but SDK v0 sends plain JSON only
  • SDK code never receives framework request objects
  • capture_exception() is an ingest helper, not a framework adapter
  • capture_exception() swallows Relivio delivery failures and records them in local status()
  • protection.get_status() is a thin read over /api/v1/protection/status; it does not make block/allow decisions
  • verdicts.latest() is intentionally narrow and only exists to support service-side guard logic
  • verdicts.latest() returns None on 404 when a verdict is not available yet
  • status() reports SDK self-diagnostics locally; it does not send host metrics to Relivio

Related Repos

  • relivio-server: server-side deploy registration, ingest, and summary generation
  • relivio-mcp: agent-facing verdict consumer surface

Security

Do not commit project API keys. Keep X-API-Key values in environment variables or local secret storage outside source control.

Contributing

Small, behavior-preserving changes are preferred. Keep transport, resource, type, and error responsibilities separate, and run the smallest effective test/build checks before sending a change.

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

relivio-0.1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

relivio-0.1.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file relivio-0.1.0.tar.gz.

File metadata

  • Download URL: relivio-0.1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for relivio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e260f8dbb5eebc8a803c2cc55423f2e8dd6bbeb3e1a60de6377e8cb6644ff66f
MD5 ce068fd568751589ad0841fa6d525751
BLAKE2b-256 c055615dba1fcd3d6a2313cd87ab79f1cf019bb1aa064002c3e477697104b985

See more details on using hashes here.

File details

Details for the file relivio-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: relivio-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for relivio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 601a8fc257a445cd86733fa4cbb3163731f5291567290bc8674798dcf5835647
MD5 8171dc56791e401a2c8325a02d83589a
BLAKE2b-256 288a980877df08f563b2b4479b729832a238ed89bae47da6a3a29b5a4b2e6a54

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