directivsys-sdk-python
directivsys-sdk-python is a Python translation of the DirectivSys .NET SDK. It provides a typed async client for DirectivSys analytics ingestion, batch synchronization, payload result polling, directive status updates, and webhook-driven directive execution.
Highlights
| Capability | Description |
|---|---|
| Strict typing | Pydantic models and explicit type hints throughout the public API |
| Async-first client | Built around httpx.AsyncClient and asyncio |
| Batch ingestion | Supports polymorphic analytic item batches with $type discrimination |
| Directive execution | Includes a base executor, registry, and webhook processing service |
| Resilience | Retry and circuit-breaker behavior for directive execution |
| FastAPI support | Optional webhook router for FastAPI applications |
Installation
pip install directivsys-sdk-python
For FastAPI webhook support:
pip install "directivsys-sdk-python[fastapi]"
For development and tests:
pip install "directivsys-sdk-python[dev]"
Quick start
import asyncio
from directivsys_sdk import DirectivSysClient, DirectivSysOptions
from directivsys_sdk.models import InventoryHealthPayload
async def main() -> None:
options = DirectivSysOptions(api_key="your-api-key")
async with DirectivSysClient(options) as client:
response = await client.submit_inventory_health(
InventoryHealthPayload(
sku="SKU-123",
stock_level=18,
reorder_point=25,
safety_stock=10,
forecasted_demand_next30_days=42,
average_lead_time_days=7,
)
)
print(response.payload_id, response.status)
asyncio.run(main())
Webhook and executor usage
The SDK includes a framework-agnostic record processor and a FastAPI router helper. You register concrete directive executors in your application and allow the service to auto-run directives whose status is auto-execute.
import logging
from directivsys_sdk import BaseDirectiveExecutor, DirectivSysClient, DirectivSysOptions
from directivsys_sdk.executors import DirectiveRegistry
from directivsys_sdk.models import DirectiveExecutionResult, ImpactData
from directivsys_sdk.service import DirectivSysService
from directivsys_sdk.webhooks import create_directivsys_router
from fastapi import FastAPI
class ReorderSupplierExecutor(BaseDirectiveExecutor):
async def execute_internal(self, parameters: dict[str, object]) -> DirectiveExecutionResult:
sku = str(parameters.get("sku", ""))
quantity = int(parameters.get("quantity", 0))
return DirectiveExecutionResult(
success=True,
message=f"Created reorder workflow for {sku}",
impact_data=ImpactData(
entity_id=sku,
property_changed="PurchaseOrderStatus",
original_value=None,
new_value="Pending",
insight_delta=quantity,
),
)
app = FastAPI()
options = DirectivSysOptions(api_key="your-api-key")
client = DirectivSysClient(options)
registry = DirectiveRegistry()
registry.register("reorderSupplier", ReorderSupplierExecutor(client, logging.getLogger("reorder")))
service = DirectivSysService(registry)
app.include_router(create_directivsys_router(service, options))
Package layout
| Module | Purpose |
|---|---|
directivsys_sdk.client |
Async API client |
directivsys_sdk.models |
Typed payloads, records, items, and responses |
directivsys_sdk.executors |
Base directive executor and registry |
directivsys_sdk.service |
Webhook record processing service |
directivsys_sdk.resilience |
Retry and circuit-breaker behavior |
directivsys_sdk.webhooks.fastapi |
FastAPI router helper |
Notes on concurrency
The SDK is intentionally async-first. It is designed to preserve the concurrency-oriented spirit of the .NET SDK without pretending that Python’s event loop is identical to .NET’s task scheduler. Async boundaries are explicit, HTTP calls are non-blocking, and directive execution resilience is centralized rather than hidden across ad hoc helper code.
Metadata
Release files for directivsys-sdk-python 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| directivsys_sdk_python-0.1.1.tar.gz | 14.7 kB | Without provenance | Details for directivsys_sdk_python-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| directivsys_sdk_python-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for directivsys_sdk_python-0.1.1-py3-none-any.whl |
Total release size: 29.1 kB
Release files / directivsys_sdk_python-0.1.1.tar.gz
| Download URL | directivsys_sdk_python-0.1.1.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12e00442f9d62bb6b9628a5e12131544f3c2c4fc5b29da593fa3b1793b5ad0f2
|
|
BLAKE2b-256 checksum How to use checksums |
2ee3b5f44abb5ceb1dc80b332327f758dcb711bb7c7c7898c36f686a8023a1ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / directivsys_sdk_python-0.1.1-py3-none-any.whl
| Download URL | directivsys_sdk_python-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb953567c04b9957b99ef21de053ad40bbdcaf7b18595ad03b34d16ff72b52b3
|
|
BLAKE2b-256 checksum How to use checksums |
daa4029544d638ac88aedbebff4f8580a1932476a6d1f256c5793b2efa91805c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for directivsys-sdk-python 0.1.1
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.