{"id":21631,"library":"observable","title":"Observable","description":"Minimalist event system for Python, inspired by the Observable pattern. Current version 1.0.3. Low release cadence; last stable release in 2017.","status":"maintenance","version":"1.0.3","language":"python","source_language":"en","source_url":"https://github.com/timofurrer/observable","tags":["observable","events","event-system","pubsub"],"install":[{"cmd":"pip install observable","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The class is Observable, not Observer.","wrong":"from observable import Observer","symbol":"Observable","correct":"from observable import Observable"}],"quickstart":{"code":"from observable import Observable\n\nclass MyObservable(Observable):\n    pass\n\nobj = MyObservable()\n\ndef callback(data):\n    print(f\"Event received: {data}\")\n\nobj.on('change', callback)\nobj.trigger('change', 'Hello, world!')\n","lang":"python","description":"Create a subclass of Observable, register a callback with .on(), and fire events with .trigger()."},"warnings":[{"fix":"Use class MyClass(Observable): instead of combining with other base classes unless using compatible metaclasses.","message":"Observable is not a mixin; you must subclass it. Adding Observable as a base class to an existing class may cause metaclass conflicts.","severity":"breaking","affected_versions":"all"},{"fix":"Verify listeners are registered before triggering, or implement a check if needed.","message":"Events are identified by string names. Triggering an event with no listeners will silently do nothing. No error is raised.","severity":"gotcha","affected_versions":"all"},{"fix":"Use *args and **kwargs in callback to handle any number of arguments, or strictly match signatures.","message":"Callback arguments are passed as positional arguments to trigger. Ensure your callback signature matches the number of arguments you pass; otherwise, a TypeError will occur.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider alternative libraries like 'pyee' or 'blinker' for active support.","message":"The library has not been updated since 2017. The API is stable but no longer maintained. Python 3.6+ compatibility may require testing.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change import to: from observable import Observable","cause":"There is no class named Observer; the correct class is Observable.","error":"ImportError: cannot import name 'Observer' from 'observable'"},{"fix":"Adjust callback signature to accept the correct number of arguments, e.g., def callback(event_name, data): or use *args.","cause":"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.","error":"TypeError: callback() takes 1 positional argument but 2 were given"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}