Skip to main content

Durable jobs/events for Demystify: asyncio mirror of @demystify/events (enqueue, transactional outbox, idempotent workers, backoff+jitter, DLQ).

Project description

demystify-events

Durable jobs and events for Python — the asyncio mirror of the TypeScript @demystify/events runtime. Postgres-backed (pgmq) with a transactional outbox, idempotent consumers, exponential backoff + full jitter retries, and a dead-letter queue — with a full-fidelity in-memory driver so the same code runs offline with no database.

Part of the Demystify Core Services suite.

Install

pip install demystify-events
# real Postgres driver (psycopg + connection pool):
pip install "demystify-events[pg]"

Quickstart (offline, no database)

from demystify_events import create_events_client
from demystify_events.adapters.memory import MemoryQueueDriver

client = create_events_client(driver=MemoryQueueDriver())

# enqueue a job
await client.enqueue("email.send", {"to": "user@example.com"})

# process it (idempotent, retried with backoff+jitter, DLQ on poison)
async def handler(ctx, job):
    ...  # do work; effects committed in the same transaction as the ack
await client.work("email.send", handler)

Switch to real Postgres by passing the psycopg driver (from the [pg] extra) with a database_url — the handler contract is identical.

What's in the box

  • create_events_client / EventsClient — enqueue, transactional enqueue_in_tx, workers
  • contract_backoff, full_jitter_backoff, BackoffConfig — retry schedules
  • ContractRegistry — JSON-schema event-type validation
  • make_envelope / validate_envelope — canonical event envelopes
  • Adapters: MemoryQueueDriver (offline) and psycopg (Postgres/pgmq)

The published wheel is self-contained — it does not vendor demystify-platform-contracts; contract convergence is asserted by the test suite. See the module README for the delivery guarantees, chaos-test results, and the /ops/v1 API.

License

MIT © Demystify Systems

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

demystify_events-0.2.0.tar.gz (109.7 kB view details)

Uploaded Source

Built Distribution

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

demystify_events-0.2.0-py3-none-any.whl (39.7 kB view details)

Uploaded Python 3

File details

Details for the file demystify_events-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for demystify_events-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0cdbfb0cba33b5dbd18d7339307fa2878f7ef3d3532a98a55162b3d68e30f0c9
MD5 659b8a09ee88d3b6ba65d9e27f2519c9
BLAKE2b-256 0dabd9893c52ecc8e58f3e502cf74c15b354a92b0b173b89d63080fb954af93a

See more details on using hashes here.

Provenance

The following attestation bundles were made for demystify_events-0.2.0.tar.gz:

Publisher: publish-pypi.yml on demystify-systems/ai-services-tools

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

File details

Details for the file demystify_events-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for demystify_events-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 488ddc7ae32e5e3a1ccc7a3bcdea4ce095f6bf40a1948c187b918d80ecf50f91
MD5 f5f591c3eee9b50c532ac85e3690ba72
BLAKE2b-256 82d00c6ec2692ab23dee712e66b005b80d08244bafcdaa666d005bb940c29656

See more details on using hashes here.

Provenance

The following attestation bundles were made for demystify_events-0.2.0-py3-none-any.whl:

Publisher: publish-pypi.yml on demystify-systems/ai-services-tools

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