{ "info": { "author": "Jonatan Rivilla Alamo", "author_email": "jonrivala@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Py-Peeper\nA very simple, minimalist, single-threaded and broadcast-routed approach to the observable pattern in Python.\n\n## Installation\n```python\npip install pypeeper\n```\n\n\n### Usage\n#### Implementing an Observable class\nEvery class can be converted to observable just by subclassing it from\nObserver. If class attribute \"pattern\" is overwritten with a valid regex\nexpression, only matching attributes defined within the class constructor will\nbe observed. Otherwise, all attributes will be observed.\n```python\nfrom pypeeper import Observable, Observer\n\nclass AnyClass(Observable):\n\n def __init__(self):\n self.attribute_a = False\n self.whatever_attr = 0\n\n def set_attribute(self, value):\n self.attribute_a = value\n```\n#### Implementing an Observer class\nAny class can be Observer of all Observable classes defined as shown above. To\ndefine how the class should react on Observable's changes, just override\n\"notify\" method from Observer class.\n```python\nclass ObserverClass(Observer):\n\n def notify(self, class_name, object_id, attribute_name, old, new):\n print(class_name, object_id, attribute_name, old, new)\n\n```\n#### Instantiate and play\n```python\nmy_observable = AnyClass()\nmy_observer = ObserverClass()\n\nmy_observable.set_attribute(True)\nmy_observable.attribute_a = 10\nmy_observable.whatever_attr = None\n```\n#### Console output\n```\n>>> AnyClass 2448221506696 attribute_a False True\n>>> AnyClass 2448221506696 attribute_a True 10\n>>> AnyClass 2448221506696 whatever_attr 0 None\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rolandshoemaker/py-peeper", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pypeeper", "package_url": "https://pypi.org/project/pypeeper/", "platform": "", "project_url": "https://pypi.org/project/pypeeper/", "project_urls": { "Homepage": "https://github.com/rolandshoemaker/py-peeper" }, "release_url": "https://pypi.org/project/pypeeper/1.1/", "requires_dist": null, "requires_python": "", "summary": "A minimalist, single-threaded and broadcast-routed observable pattern.", "version": "1.1" }, "last_serial": 5494675, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "789b2f9191b092b86c7ddce3e9278b56", "sha256": "5391040348b3db6b1820d6905e6879e2be1e2e97e687d24c27d62908efee9e07" }, "downloads": -1, "filename": "pypeeper-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "789b2f9191b092b86c7ddce3e9278b56", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5543, "upload_time": "2019-06-21T21:22:47", "url": "https://files.pythonhosted.org/packages/2b/a4/cba4124991d35b2a2edf81f3ae957c251896e7b0d29189d589c08e7e17fd/pypeeper-0.2-py3-none-any.whl" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "037fbcb5fbc258a4968916910866bea1", "sha256": "43bc514ff6c1653062bb3219eb4a5808c473a33d064a01d43cbdfaef5504901e" }, "downloads": -1, "filename": "pypeeper-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "037fbcb5fbc258a4968916910866bea1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5564, "upload_time": "2019-06-27T19:04:59", "url": "https://files.pythonhosted.org/packages/53/45/b2462f5167cc16115b9f23e4836e5bd988e2f3a11bde4b31f8f4355958a3/pypeeper-0.3-py3-none-any.whl" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "7e848b40de7eca3031022d8606d971b3", "sha256": "bb479f449dc77d159cfbcebbfeb31cca7635e60de4023bb04f2b327277c8491e" }, "downloads": -1, "filename": "pypeeper-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7e848b40de7eca3031022d8606d971b3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6501, "upload_time": "2019-07-06T11:28:47", "url": "https://files.pythonhosted.org/packages/86/0a/ca0d5984454568c06d5034e0de9625f749d76d85bc0dd9a71248426c52d1/pypeeper-1.0-py3-none-any.whl" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "8dc5636b2c1fb0d27246afb2e68c766b", "sha256": "be1c1e7f28ff9b089a23e31873e4a1e140699e73bf17b9ac8016bdb5507851de" }, "downloads": -1, "filename": "pypeeper-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8dc5636b2c1fb0d27246afb2e68c766b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6495, "upload_time": "2019-07-06T12:17:42", "url": "https://files.pythonhosted.org/packages/c5/bd/9bcf15b336084445db24328d1f9ff5847ac028cf63fd6c929d687a54fccc/pypeeper-1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8dc5636b2c1fb0d27246afb2e68c766b", "sha256": "be1c1e7f28ff9b089a23e31873e4a1e140699e73bf17b9ac8016bdb5507851de" }, "downloads": -1, "filename": "pypeeper-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8dc5636b2c1fb0d27246afb2e68c766b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6495, "upload_time": "2019-07-06T12:17:42", "url": "https://files.pythonhosted.org/packages/c5/bd/9bcf15b336084445db24328d1f9ff5847ac028cf63fd6c929d687a54fccc/pypeeper-1.1-py3-none-any.whl" } ] }