Registry / observability / observable

observable

JSON →
library1.0.3pypypi✓ verified 85d ago

Minimalist event system for Python, inspired by the Observable pattern. Current version 1.0.3. Low release cadence; last stable release in 2017.

pip install observable
INSTALL
IMPORT
SIG · OBSERVABLE
O
observable
observabilitypythonv1.0.3
Install
1.6s avg
Import
11ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.012s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.006s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Observable
from observable import Observable
from observable import Observer
The class is Observable, not Observer.

Create a subclass of Observable, register a callback with .on(), and fire events with .trigger().

from observable import Observable class MyObservable(Observable): pass obj = MyObservable() def callback(data): print(f"Event received: {data}") obj.on('change', callback) obj.trigger('change', 'Hello, world!')
Debug
Known issues
breakingObservable is not a mixin; you must subclass it. Adding Observable as a base class to an existing class may cause metaclass conflicts.
fix
Use class MyClass(Observable): instead of combining with other base classes unless using compatible metaclasses.
affects: all
gotchaEvents are identified by string names. Triggering an event with no listeners will silently do nothing. No error is raised.
fix
Verify listeners are registered before triggering, or implement a check if needed.
affects: all
gotchaCallback arguments are passed as positional arguments to trigger. Ensure your callback signature matches the number of arguments you pass; otherwise, a TypeError will occur.
fix
Use *args and **kwargs in callback to handle any number of arguments, or strictly match signatures.
affects: all
deprecatedThe library has not been updated since 2017. The API is stable but no longer maintained. Python 3.6+ compatibility may require testing.
fix
Consider alternative libraries like 'pyee' or 'blinker' for active support.
affects: >=1.0.0
Errors
Common errors & fixes
ImportError: cannot import name 'Observer' from 'observable'
There is no class named Observer; the correct class is Observable.
fix
Change import to: from observable import Observable
TypeError: callback() takes 1 positional argument but 2 were given
The callback expects a single argument but trigger is called with two arguments (event name and data). The callback receives all arguments passed to trigger after the event name.
fix
Adjust callback signature to accept the correct number of arguments, e.g., def callback(event_name, data): or use *args.
Upgrade
Version history
1.0.3latest on PyPI · released Sep 20, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
2
Resources
observable — pip install observable · libregistry