Skip to main content

PyEventEngine

docs pypi-linux pypi-windows

High-performance, topic-driven event engine for Python with a Cython-accelerated core and a native Python fallback.

  • Fast publish/subscribe event routing by topic (exact + generic wildcard/pattern matching)
  • Clean, typed API with drop-in fallback when C extensions are unavailable
  • Built-in timers, handler stats (EventHookEx), and convenient formatting helpers

Installation

# From PyPI (pre-compiled wheels available)
pip install PyEventEngine

# From source (requires C compiler + Cython ≥ 3.0)
git clone https://github.com/BolunHan/PyEventEngine.git
cd PyEventEngine

# Build + install
./build.sh -i

# Or via Makefile:
make build && pip install -U . --no-build-isolation

# Or step by step:
python setup.py build_ext --inplace --verbose --force
pip install -U . --no-build-isolation

See the Installation Guide for platform-specific prerequisites, compile-time macros, and troubleshooting.

Quick Start

import time
from event_engine import EventEngine, Topic

# Create and start the engine
engine = EventEngine(capacity=8192)
engine.start()

# Register a handler for an exact topic
exact = Topic('Demo.Hello')

def hello_handler(name: str, topic=None):
    print(f"Hello {name} from {topic.value if topic else 'N/A'}")

engine.register_handler(exact, hello_handler)

# Publish a message
engine.put(exact, 'World')

# Clean up
time.sleep(0.1)
engine.stop()
engine.clear()

Generic topics (wildcards/patterns)

import time
from event_engine import Topic, EventEngine

engine = EventEngine()
pattern = Topic('Demo.{what}')

calls = []

def f(what: str, topic=None):
    calls.append((what, topic.value))

engine.register_handler(pattern, f)

engine.start()
engine.put(Topic('Demo.Test'), 'a test sub-topic')
engine.put(Topic('Demo.Live'), 'a live sub-topic')
time.sleep(0.1)  # allow time for processing
engine.stop()

print(calls)  # [('a test sub-topic', 'Demo.Test'), ('a live sub-topic', 'Demo.Live')]

Timers (EventEngineEx)

import time
from event_engine import EventEngineEx, Topic

engine = EventEngineEx(capacity=4096)
engine.start()

# Create a 1-second timer topic and subscribe
timer_topic = engine.get_timer(1.0)
engine.register_handler(timer_topic, lambda **kw: print('tick', kw))

time.sleep(3)
engine.stop()
engine.clear()

Logging

By default, the package uses a colored logger under event_engine.base. To integrate with your application's logging, call set_logger once after import — it propagates to submodules.

import logging
from event_engine import set_logger

logger = logging.getLogger('MyApp')
logger.setLevel(logging.INFO)
set_logger(logger)

Fallback behavior

On import, the package tries to use the Cython implementation (event_engine.capi). If that fails (e.g., no compiler available), it automatically falls back to the native Python implementation (event_engine.native). Check the active backend:

from event_engine import USING_FALLBACK
print('Using native fallback?', USING_FALLBACK)

Development

# Clone and build in-place
git clone https://github.com/BolunHan/PyEventEngine.git
cd PyEventEngine
./build.sh -i

# Run tests
python -m pytest demo/

# Performance benchmarks
python demo/native_performance_test.py
python demo/capi_performance_test.py       # requires compiled extensions

Build scripts

Command Effect
./build.sh -i Clean + build + install
./build.sh -l List compile-time macros
make build Clean + build in-place
make clean-all Deep clean (removes .c/.so)

Documentation

Full documentation: https://bolunhan.github.io/PyEventEngine/

Build locally:

pip install sphinx furo sphinx-autodoc-typehints
cd docs
sphinx-build -M html . _build
# Open _build/html/index.html

License

MIT — see LICENSE.

Metadata

Release files for PyEventEngine 0.6.2.post1

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

Built distributions (wheels)

Table of built distributions (wheels) for PyEventEngine 0.6.2.post1
File Actions
pyeventengine-0.6.2.post1-cp315-cp315t-win_amd64.whl CPython 3.15 CPython 3.15 free-threading Windows x86-64 Details for pyeventengine-0.6.2.post1-cp315-cp315t-win_amd64.whl
pyeventengine-0.6.2.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 free-threading Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pyeventengine-0.6.2.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pyeventengine-0.6.2.post1-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details for pyeventengine-0.6.2.post1-cp315-cp315-win_amd64.whl
pyeventengine-0.6.2.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for pyeventengine-0.6.2.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pyeventengine-0.6.2.post1-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details for pyeventengine-0.6.2.post1-cp314-cp314t-win_amd64.whl
pyeventengine-0.6.2.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for pyeventengine-0.6.2.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pyeventengine-0.6.2.post1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for pyeventengine-0.6.2.post1-cp314-cp314-win_amd64.whl
pyeventengine-0.6.2.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pyeventengine-0.6.2.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pyeventengine-0.6.2.post1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pyeventengine-0.6.2.post1-cp313-cp313-win_amd64.whl
pyeventengine-0.6.2.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for pyeventengine-0.6.2.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pyeventengine-0.6.2.post1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pyeventengine-0.6.2.post1-cp312-cp312-win_amd64.whl
pyeventengine-0.6.2.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pyeventengine-0.6.2.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Total release size: 29.9 MB

Release files / pyeventengine-0.6.2.post1-cp315-cp315t-win_amd64.whl

Download URL pyeventengine-0.6.2.post1-cp315-cp315t-win_amd64.whl
Size 1.7 MB
Tags CPython 3.15 CPython 3.15 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
fdcaf4042176479a388d4ea5ce678c865341ea45e5d9efd2ed20a90d033b2888
BLAKE2b-256 checksum
How to use checksums
d3e04bf06def86ae56e1db1d5ad193b1c2f4280af1165ca0dd9a15bcf76a7e3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyeventengine-0.6.2.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 3.4 MB
Tags CPython 3.15 CPython 3.15 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
271c10f17502a299607b5d732013c2afe830b778a799486d22719fc3fc92f48d
BLAKE2b-256 checksum
How to use checksums
d9c4e0d9e0742a1a1756160ff4d20d546479c57bc0f5b750c9f78d4365b9c426
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp315-cp315-win_amd64.whl

Download URL pyeventengine-0.6.2.post1-cp315-cp315-win_amd64.whl
Size 1.7 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
a2ec1907d37823419014c2ca8d30666acf7244c2403bd29ec70d5828041baaa3
BLAKE2b-256 checksum
How to use checksums
cc94756affe031a953096068b0170d747020bbee8a7ffc0419689805f7562680
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyeventengine-0.6.2.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 3.3 MB
Tags CPython 3.15 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
23a44ba6003c91c3e9092fc7a38565aec5687a86182ebd05e142e6a1d2813a52
BLAKE2b-256 checksum
How to use checksums
353edcd2552fdf1bc941a2b5b7458b4bff7c64fbf51a296eb74bbc8977e982fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp314-cp314t-win_amd64.whl

Download URL pyeventengine-0.6.2.post1-cp314-cp314t-win_amd64.whl
Size 1.7 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
0a42fe67b53f324644ed36671716ca8d077ee26dc7ea13fc43696dfc3b357c9c
BLAKE2b-256 checksum
How to use checksums
7da5aac22539760b6496d3dfe1d0dae12415e8485fd3d7c2e06ef553e8df5db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyeventengine-0.6.2.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 3.4 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2d8f8bdb74c68d7da52556407648ce745ea7494dec27119f3e7b619bcfe168f7
BLAKE2b-256 checksum
How to use checksums
4c1f3a8b4545ca2f7058368b509b769046877d2ce07fd9a1a9bc8ef7fc9f6641
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp314-cp314-win_amd64.whl

Download URL pyeventengine-0.6.2.post1-cp314-cp314-win_amd64.whl
Size 1.7 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
9f0de36c968db45f870a11b42d75525a624f4e9664834f915ddcea9a79144e39
BLAKE2b-256 checksum
How to use checksums
781016f113bbeba0b1480b79d8a0cb052ab83dbbcc51b899b62caaf62555381b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyeventengine-0.6.2.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 3.3 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b8a3b2e3735837ddfcbb2607fee9d3317519cb07530f564cce20b4b0e0f14828
BLAKE2b-256 checksum
How to use checksums
eec3dc1081451b5610bbef1c5cfb035944d8098cd7e7c1d689be27516e56e285
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp313-cp313-win_amd64.whl

Download URL pyeventengine-0.6.2.post1-cp313-cp313-win_amd64.whl
Size 1.6 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
80ea177639a7463ad50eeb3fa723a28387ad421841a04b8c07bb80ea1dbf0e90
BLAKE2b-256 checksum
How to use checksums
24443c5b50e4da36adb0ea62219d197054df9109081eba81ce52952fbcc8ddb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyeventengine-0.6.2.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 3.3 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3918e72bcfd50f721ef3d7f2fa71bb280afb8bb7722405b955661bbdc03a40b7
BLAKE2b-256 checksum
How to use checksums
11750377e87d9d854dcf025a9cbdf8b1f8ada58a4877eb52a97409fd5c72e142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp312-cp312-win_amd64.whl

Download URL pyeventengine-0.6.2.post1-cp312-cp312-win_amd64.whl
Size 1.6 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
1eb8d668914e767dbdb97a5afd75c01273e5b7799815315a1c885238974ead79
BLAKE2b-256 checksum
How to use checksums
64f5f954c6895372a84b8e57e54352a5ede82794b598a35ee6bd39b649fc50ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyeventengine-0.6.2.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pyeventengine-0.6.2.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 3.3 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e37b0d01e79cc772fb8bae2fd6cc93fa4a696e5529e9ba994b8f1cd1a8b9b9e5
BLAKE2b-256 checksum
How to use checksums
f025dbbd04599b06880a06df03dbbc000e6eb9e30119517aa82ea01f123e3345
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for PyEventEngine 0.6.2.post1

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.6.2.post1 This release

12 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