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.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

event_processor-3.1.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: event-processor-3.1.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for event-processor-3.1.0.tar.gz
Algorithm Hash digest
SHA256 cb96d1c3fbd585523ab46e66382e60927aec65a1e2f4fb2e57caafb5bd00dcbb
MD5 0bdac82dc3c29f5ad594722237e6fb29
BLAKE2b-256 2305adf88f66280c5ae29418cc76cf7d96e3a9e62447a4f142056bdbe7c1d44b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: event_processor-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for event_processor-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a9bef5df3731374a062073884be149b0476b80919f6f1ae869b25a024abb4a3
MD5 67a07d9ac10853be1f4786ea9543d586
BLAKE2b-256 fb2e39a8125eb7b69737a64ad504514189df7783896afaaa025bce761d6f8344

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