Skip to main content

A port of node.js's primus/eventemitter3 to python. Based on jfhbrook/pyee.

Project description

pyee2

Code style: black

pyee2 is the primus/eventemitter3 EventEmitter implementation ported to python based on jfhbrook/pyee.

pyee2:

  • Does not raise or emit an error event when your listener raises an error and no one is listening for the "error" event. That is to say pyee2 catches all errors raised by event listeners and only emits an error if there are listeners for the "error" event.
  • Does not not emit an event when a new listener is added or removed.
  • Only supports function or functions that return awaitables (coroutine, future, task) as event listeners. The test for awaitableness is done via "inspect.isawaitable"
from pyee2 import EventEmitter

ee = EventEmitter()

@ee.on("event")
def handler(arg, data=3):
    print(f"handler called arg={arg} data={data}")

ee.emit("event", 1, data=2)

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

pyee2-1.0.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

pyee2-1.0.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pyee2-1.0.0.tar.gz.

File metadata

  • Download URL: pyee2-1.0.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for pyee2-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aaf282c2102dd7ffcbc4aaa19a547549e14bd2fcc7e2c0ce6ad54ded6d24bbe7
MD5 a7c4cc57a7228815ace9f46d72461c8d
BLAKE2b-256 13c617fa492c1559d3096077568ea0a940ddb5a02bbf10ed8faba282ca633e45

See more details on using hashes here.

File details

Details for the file pyee2-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyee2-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for pyee2-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12d72423242473d4415edff8873277730b85888a3e6e82acb4d4fc5681368196
MD5 2bd487299bf4fb61f4ef54adb5aef6f7
BLAKE2b-256 0a137d9c24764914ed80bb9ffde14e752acaa0bf7c7e2e3657850efa4a41d113

See more details on using hashes here.

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