Skip to main content

Pythonic event-processing library based on decorators

Project description

Process Events In Style

build coverage code-size docs

This library aims to simplify the common pattern of event processing. It simplifies the process of filtering, dispatching and pre-processing events as well as injecting dependencies in event processors.

The only requirement is that your events are regular python dictionaries.

Take a look at the following examples to get an overview of the features available! Of course, you can mix and combine them in any way you like to create more complex scenarios.

from event_processor import EventProcessor, Event
from event_processor.filters import Eq


event_processor = EventProcessor()


@event_processor.processor(Eq("service.type", "service_a"))
def process_service_a(event: Event):
    return event["service"]["status"] == "up"

@event_processor.processor(Eq("service.type", "service_b"))
def process_service_b(event: Event):
    return event["authorized"]

service_a_event = {
    "service": {
        "type": "service_a",
        "status": "down"
    }
}
service_b_event = {
    "service": {
        "type": "service_b",
        "authorized": False
    }
}
event_processor.invoke(service_a_event)  # False
event_processor.invoke(service_b_event)  # False

Documentation

Find the full documentation on Read the Docs.

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

event-processor-3.1.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

event_processor-3.1.2-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file event-processor-3.1.2.tar.gz.

File metadata

  • Download URL: event-processor-3.1.2.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for event-processor-3.1.2.tar.gz
Algorithm Hash digest
SHA256 025fb93cd578152a2bf1e0c3ff7b93d2660d12d38e16054d10a2458e016eaec5
MD5 4ced5ddcc0222eb7810c1fb64db2b8b7
BLAKE2b-256 970b0e01070fa16079714080cec4a853e606fee74c39d94a45a375b0face96c5

See more details on using hashes here.

File details

Details for the file event_processor-3.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for event_processor-3.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 95ab3f9a4283bccc10e1f12be93a006b5876d85dd2291205cd0e9b7fefb13101
MD5 e980317871b240e80b404c0a44e9ed48
BLAKE2b-256 6cc36485fefa63435e381ec471d7f39a63059f249e7e1eeff49c91ca69f8d4c0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page