Shared Prophet event publisher runtime
Project description
prophet-events-runtime
prophet-events-runtime is the shared Python runtime contract used by Prophet-generated action services.
Main project repository:
It defines:
- an async
EventPublisherprotocol - a canonical
EventWireEnvelopedataclass - utility helpers (
create_event_id,now_iso) - sync bridge helpers (
publish_sync,publish_batch_sync) - a
NoOpEventPublisherfor local wiring and tests
Install
python3 -m pip install prophet-events-runtime
API
from typing import Iterable, Protocol
class EventPublisher(Protocol):
async def publish(self, envelope: EventWireEnvelope) -> None: ...
async def publish_batch(self, envelopes: Iterable[EventWireEnvelope]) -> None: ...
from dataclasses import dataclass
from typing import Dict, List, Optional
@dataclass(kw_only=True)
class EventWireEnvelope:
event_id: str
trace_id: str
event_type: str
schema_version: str
occurred_at: str
source: str
payload: Dict[str, object]
attributes: Optional[Dict[str, str]] = None
updated_objects: Optional[List[Dict[str, object]]] = None
Exports:
EventPublisherEventWireEnvelopeNoOpEventPublishercreate_event_id()now_iso()publish_sync(publisher, envelope)publish_batch_sync(publisher, envelopes)
Implement a Platform Publisher
from __future__ import annotations
from typing import Iterable
from prophet_events_runtime import EventPublisher
from prophet_events_runtime import EventWireEnvelope
class PlatformClient:
async def send_event(self, payload: dict) -> None: ...
async def send_events(self, payloads: list[dict]) -> None: ...
class PlatformEventPublisher(EventPublisher):
def __init__(self, client: PlatformClient) -> None:
self._client = client
async def publish(self, envelope: EventWireEnvelope) -> None:
await self._client.send_event(envelope.__dict__)
async def publish_batch(self, envelopes: Iterable[EventWireEnvelope]) -> None:
await self._client.send_events([envelope.__dict__ for envelope in envelopes])
With Prophet-Generated Code
Generated Python action services publish event wire envelopes after successful handler execution.
If you do not provide an implementation, you can wire NoOpEventPublisher for local development.
Local Validation
From repository root:
PYTHONPATH=prophet-lib/python/src python3 -m unittest discover -s prophet-lib/python/tests -p 'test_*.py' -v
.venv/bin/pip install -r requirements-dev.txt
.venv/bin/python -m build prophet-lib/python
.venv/bin/python -m twine check prophet-lib/python/dist/*
More Information
- Main repository README: https://github.com/Chainso/prophet#readme
- Runtime index: https://github.com/Chainso/prophet/tree/main/prophet-lib
- Event wire contract: https://github.com/Chainso/prophet/tree/main/prophet-lib/specs/wire-contract.md
- Event wire JSON schema: https://github.com/Chainso/prophet/tree/main/prophet-lib/specs/wire-event-envelope.schema.json
- Python integration reference: https://github.com/Chainso/prophet/tree/main/docs/reference/python.md
- Example app: https://github.com/Chainso/prophet/tree/main/examples/python/prophet_example_fastapi_sqlalchemy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prophet_events_runtime-0.8.0.tar.gz.
File metadata
- Download URL: prophet_events_runtime-0.8.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd3a05ccfa704c72179bd02838d54b0e6fa8843ff99f5405d96f5d4ec610a070
|
|
| MD5 |
3384369a307828f6da893bf315f3f44f
|
|
| BLAKE2b-256 |
2ef05a6437bd4aaebce7146b9e885cf55e459cabb3d25fd0c2af84b4d21c7fd3
|
Provenance
The following attestation bundles were made for prophet_events_runtime-0.8.0.tar.gz:
Publisher:
publish-prophet-lib.yml on Chainso/prophet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prophet_events_runtime-0.8.0.tar.gz -
Subject digest:
dd3a05ccfa704c72179bd02838d54b0e6fa8843ff99f5405d96f5d4ec610a070 - Sigstore transparency entry: 1108041906
- Sigstore integration time:
-
Permalink:
Chainso/prophet@d2ec5f3b24d91303509b74894e17a732a5c83422 -
Branch / Tag:
refs/tags/lib-v0.8.0 - Owner: https://github.com/Chainso
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-prophet-lib.yml@d2ec5f3b24d91303509b74894e17a732a5c83422 -
Trigger Event:
push
-
Statement type:
File details
Details for the file prophet_events_runtime-0.8.0-py3-none-any.whl.
File metadata
- Download URL: prophet_events_runtime-0.8.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3015ff49e4693ae9c853c87104e8f33959ec8c948c0384a521c009935c01bb43
|
|
| MD5 |
f217c942720d123912e1b74ad7619ec0
|
|
| BLAKE2b-256 |
20448cda442a2a1ad1c6740896bdef6ac96fa2a1abba29f2a88129c206801caf
|
Provenance
The following attestation bundles were made for prophet_events_runtime-0.8.0-py3-none-any.whl:
Publisher:
publish-prophet-lib.yml on Chainso/prophet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prophet_events_runtime-0.8.0-py3-none-any.whl -
Subject digest:
3015ff49e4693ae9c853c87104e8f33959ec8c948c0384a521c009935c01bb43 - Sigstore transparency entry: 1108041910
- Sigstore integration time:
-
Permalink:
Chainso/prophet@d2ec5f3b24d91303509b74894e17a732a5c83422 -
Branch / Tag:
refs/tags/lib-v0.8.0 - Owner: https://github.com/Chainso
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-prophet-lib.yml@d2ec5f3b24d91303509b74894e17a732a5c83422 -
Trigger Event:
push
-
Statement type: