Skip to main content

Micropython compatible producer/subscriber event bus system with optional threading.

Project description

micropython-event-bus

Micropython producer/subscriber event system with optional threading

Note that this package is early stages so could have undocumented bugs.

The not-so-magic school bus

Installation

pip3 install micropython-event-bus

or Clone this repository into your project:

git clone https://github.com/jaycosaur/micropython-event-bus

Usage

from micropython_event_bus import Producer, subscribe

# setup simple producer
my_producer = Producer(name="my first producer")

# create subscriber
# with decorator
@subscribe(my_producer)
def my_subscriber(*args, **kwargs):
    print('I got a message!')

# or by calling the producer subscribe method
def my_second_subscriber(*args, **kwargs):
    print('I also got a message!')

my_producer.subscribe(my_second_subscriber)

# emit event

# from producer via __call__ method
my_producer(1,2,3,4)
# or by calling emit directly
my_producer.emit(1,2,3,4)

For more examples please refer to the examples

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

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

micropython_event_bus-0.0.4.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

micropython_event_bus-0.0.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file micropython_event_bus-0.0.4.tar.gz.

File metadata

  • Download URL: micropython_event_bus-0.0.4.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for micropython_event_bus-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4891199049ae12a152b099e91fc966cd1600b5115c6c1981f17e0148b0307079
MD5 06fde77710e5fe0e1026336065511953
BLAKE2b-256 fb0f253df818e25e83a45507dd368d572e2842fa4e4962589084aa8ce7a6603b

See more details on using hashes here.

File details

Details for the file micropython_event_bus-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: micropython_event_bus-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for micropython_event_bus-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 965de77712de022d440c90cdbd39e45ccbdb31bada2dc7ad2b93da401c410174
MD5 01780f4c3cbbb5d71ecde8fd6e813419
BLAKE2b-256 73ba454975269b044870c763a5c74b116d4bdbdc07dd9a57e3c2ca0dacf811d6

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