Skip to main content

Cloud native framework for building event driven applications in Python

Tests Build License Python Format PyPi Code Style security: bandit

Note: This package is under active development and is not recommended for production use


Version: 0.1.3

Documentation: https://performancemedia.github.io/eventiq/

Repository: https://github.com/performancemedia/eventiq


About

The package utilizes pydantic, async_timeout and python-json-logger as the only required dependencies. For messages Cloud Events format is used. Service can be run as standalone processes, or included into starlette (e.g. FastAPI) applications.

Installation

pip install eventiq

Multiple broker support (in progress)

  • Stub (in memory using asyncio.Queue for PoC, local development and testing)
  • NATS (with JetStream)
  • Redis Pub/Sub
  • Kafka
  • Rabbitmq
  • Google Cloud PubSub
  • And more comming

Optional Dependencies

  • cli - typer and aiorun
  • broker of choice: nats, kafka, rabbitmq, redis, pubsub
  • custom message serializers: msgpack, orjson
  • prometheus - Metric exposure via PrometheusMiddleware

Motivation

However, those libraries don't provide a pub/sub pattern, useful for creating event driven and loosely coupled systems. Furthermore, the majority of those libraries do not support asyncio. This is why this project was born.

Basic usage

import asyncio
from eventiq import Service, CloudEvent, Middleware
from eventiq.backends.nats.broker import JetStreamBroker


class SendMessageMiddleware(Middleware):
    async def after_broker_connect(self, broker: "Broker") -> None:
        print(f"After service start, running with {broker}")
        await asyncio.sleep(10)
        for i in range(100):
            await broker.publish("test.topic", data={"counter": i})
        print("Published event(s)")

broker = JetStreamBroker(url="nats://localhost:4222")
broker.add_middleware(SendMessageMiddleware())

service = Service(name="example-service", broker=broker)

@service.subscribe("test.topic")
async def example_run(message: CloudEvent):
    print(f"Received Message {message.id} with data: {message.data}")


if __name__ == "__main__":
    service.run()

Scaling

Each message is load-balanced (depending on broker) between all service instances with the same name. To scale number of processes you can use containers (docker/k8s), supervisor, or web server like gunicorn.

TODOS:

  • More tests
    • Integration tests with docker-compose and all backends
  • Docs + tutorials
  • OpenTelemetry Middleware (?)

Metadata

Release files for eventiq 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eventiq 0.1.3
File Size Uploaded Provenance Actions
eventiq-0.1.3.tar.gz 29.3 kB Without provenance Details for eventiq-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eventiq 0.1.3
File Interpreter ABI Platform Actions
eventiq-0.1.3-py3-none-any.whl Python 3 none any Details for eventiq-0.1.3-py3-none-any.whl

Total release size: 74.8 kB

Release files / eventiq-0.1.3.tar.gz

Download URL eventiq-0.1.3.tar.gz
Size 29.3 kB
Tags Source
SHA-256 checksum
How to use checksums
53f2d51edc0695a0b06d629c3b873a2691b6b192a9357e5e0e388fa0200758bb
BLAKE2b-256 checksum
How to use checksums
a1d9548a1a3d31df209fc7ff8896823aad5a81a8a54d9e435f3e371ad1eaf2aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / eventiq-0.1.3-py3-none-any.whl

Download URL eventiq-0.1.3-py3-none-any.whl
Size 45.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
247451c2f04084701a4c3405132349059c9408101e530f5529c85ca70d906d91
BLAKE2b-256 checksum
How to use checksums
5e5a85e38ff53cc944a5825ce81731653ff0d70c6c5b8bc01a6c210592bcf134
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for eventiq 0.1.3

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.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page