Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

fancy-event

Usage

import fancy.eventbus as fe


class MyEvent:
    value: int

    def __init__(self, value):
        self.value = value


class MyEvent2:
    pass


class Target:
    def __init__(self):
        fe.register(self)

    @fe.SubscribeEvent()
    def on_start(self, event: fe.StartEvent):
        print("start!")
        fe.post(MyEvent(1))

    @fe.SubscribeEvent()
    def my_event(self, event: MyEvent):
        print("my_event", event.value)
        fe.post(MyEvent2())
        fe.post(self)

    @fe.SubscribeEvent()
    def my_event2(self, event: MyEvent2):
        print("my_event2")
        raise RuntimeError("an error")

    @fe.SubscribeEvent(priority=fe.EventPriority.HIGHEST)  # execute before my_event2
    def self_as_event(self, event: "Target"):  # forwarding ref
        print("self_as_event", event is self)

    @fe.SubscribeEvent()
    def error_handler(self, e: RuntimeError):
        print("handle by runtime error", e)

    @fe.SubscribeEvent(priority=fe.EventPriority.LOW)  # method name should different
    def error_handler2(self, e: Exception):
        print("handle by exception", e)
        return False  # returned false will cancel the event

    @fe.SubscribeEvent(priority=fe.EventPriority.LOWEST)
    def error_handler3(self, e: BaseException):
        print("this should be canceled.", e)


loop = fe.EventLoop()
# registers
Target()

loop.start()
start!
my_event 1
self_as_event True
my_event2
handle by runtime error an error
handle by exception an error

Metadata

Release files for fancy-eventbus 0.1.0a0

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

Source distribution (sdist)

Source distribution for fancy-eventbus 0.1.0a0
File Size Uploaded Provenance Actions
fancy-eventbus-0.1.0a0.tar.gz 7.5 kB Without provenance Details for fancy-eventbus-0.1.0a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fancy-eventbus 0.1.0a0
File Interpreter ABI Platform Actions
fancy_eventbus-0.1.0a0-py3-none-any.whl Python 3 none any Details for fancy_eventbus-0.1.0a0-py3-none-any.whl

Total release size: 21.7 kB

Release files / fancy-eventbus-0.1.0a0.tar.gz

Download URL fancy-eventbus-0.1.0a0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
625fd21e6fb21b45f290d5142c211c75f3f494eaa1bc5e7f9da4142a8b49df06
BLAKE2b-256 checksum
How to use checksums
0b9fba842423082afd5211cedeccc6badb154055e718a3a80ec5267265b7bcde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

Release files / fancy_eventbus-0.1.0a0-py3-none-any.whl

Download URL fancy_eventbus-0.1.0a0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a9b9903c0d9b4b11e4ae35be0661a4329a5d55046346b6eac21b71d81aaadb2
BLAKE2b-256 checksum
How to use checksums
16b0d8941c6b9c69df0b9c4a248479f107b547ae17840cf1b5b5bd79f48a9d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

Security for fancy-eventbus 0.1.0a0

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
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