{ "info": { "author": "Steven Costiou", "author_email": "steven.costiou@abc.fr", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development", "Topic :: Software Development :: Code Generators", "Topic :: Software Development :: Debuggers", "Topic :: Software Development :: Libraries" ], "description": "=====================================================================================\nReflectivipy: A Python Implementation of the Reflectivity API from the Pharo language\n=====================================================================================\n|Downloads|\n\n.. |Downloads| image:: https://pepy.tech/badge/reflectivipy\n\nReflectivipy is an API inspired by `Reflectivity in Pharo\n`_. Reflectivity allows you to deal\nwith partial behavioral reflection in Python by letting you install ``MetaLink``\ndirectly on method AST nodes. Moreover, Reflectivity provides object-centric\ncapabilities and let you install a modified behavior on a dedicated object.\n\nLet see how to install a link on a method AST towards a meta-object:\n\n.. code-block:: python\n\n import reflectivipy\n\n\n # We define a new meta-object that will act as a logger\n # each time a dedicated AST node will be \"visited/executed\"\n class MetaLogger(object):\n def log_me(self):\n print(\"I'm here\")\n\n\n # Here is the class we will instrument\n class ExampleClass(object):\n def foo(self):\n print('Executing foo')\n\n\n # We create a link ('control' is 'before' by default)\n link = reflectivipy.MetaLink(MetaLogger(), selector='log_me', control='before')\n\n # We get the method AST we want to instrument\n rf_ast = reflectivipy.reflective_ast_for_method(ExampleClass, 'foo')\n\n # We select the node that we want to install the link on\n # Here we selected the \"print 'Executing foo'\" AST node.\n node = rf_ast.body[0].body[0]\n\n # We install the link on the node\n reflectivipy.link(link, node)\n\n a = ExampleClass()\n a.foo()\n\n # When we don't need it anymore, we remove it\n print('Uninstall Metalink')\n link.uninstall()\n\n a.foo()\n\n # Produces:\n #\n # I'm here\n # Executing foo\n # Uninstall Metalink\n # Executing foo\n\n\nThis small code example uses the two main Reflectivipy concepts:\n\n- the meta-object definition, i.e: the object that will own the behavior to add\n- the ``MetaLink`` in itself which link the meta-object to the AST node that\n must be modified.\n\nThe MetaLink ``link`` is used to install a new behavior ``before`` the code\nassociated to the AST node on which it will be installed. The method AST is\nthen gathered using the ``reflective_ast_for_method`` function. The desired AST\nnode is gathered (here it's the ``print`` node). Finally, the node and the\nmeta-behavior are linked together using the ``link`` function. Once the new\nmeta-behavior is not required anymore, the ``uninstall`` method of the created\nlink is called. This call uninstall the link from every node it could be\ninstalled on.\n\nOn top of that, meta-behavior can be installed for a dedicated instance instead\nof a class. To do that, it's just a matter of asking for the\n``reflective_ast_for_method`` of the instance instead of the one from the class.\nThe code remains then exactly the same.\n\n\nInstallation\n============\n\nCurrently, Reflectivity is now on ``pypi``, so you can install it using\n``pip``. It is recommanded to install it in the virtualenv.\n\n.. code-block:: bash\n\n $ pip install reflectivipy\n\n\nQuick Start\n===========\n\n\nContributors\n============\n\n* Steven Costiou (`@StevenCostiou `_), main author of Reflectivipy\n* Vincent Aranega (`@aranega `_)\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/StevenCostiou/reflectivipy", "keywords": "object-centric partial-behavior-reflection metaprogramming", "license": "", "maintainer": "", "maintainer_email": "", "name": "reflectivipy", "package_url": "https://pypi.org/project/reflectivipy/", "platform": "", "project_url": "https://pypi.org/project/reflectivipy/", "project_urls": { "Homepage": "https://github.com/StevenCostiou/reflectivipy" }, "release_url": "https://pypi.org/project/reflectivipy/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "A Python Implementation of the Reflectivity API from the Pharo language", "version": "0.1.1" }, "last_serial": 5373436, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "0b43f26399294f4a89f7039c1910706f", "sha256": "7533f73da96fd788a684660d7b34d1370ffe433bfab02ab9c62f1772aad9ebf8" }, "downloads": -1, "filename": "reflectivipy-0.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "0b43f26399294f4a89f7039c1910706f", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 13027, "upload_time": "2019-02-11T12:34:45", "url": "https://files.pythonhosted.org/packages/b3/a1/686a7dcbd6d88475d62f8ed48e4cb6ccd8132b9fab6b718c67cdfb8d2c46/reflectivipy-0.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b33ef8010d45c9f463cf7ed65347879b", "sha256": "841cc5ca3a5a4eb399c9bb6f7b83981e222bd9823a47f6c6f497a65b199559da" }, "downloads": -1, "filename": "reflectivipy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b33ef8010d45c9f463cf7ed65347879b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9188, "upload_time": "2019-02-11T12:34:47", "url": "https://files.pythonhosted.org/packages/bb/02/67a48215c6a66fef64025941501b3a0b0c5c4a7b2f58822fa80f6d08352e/reflectivipy-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "0c22c30bacb1cb0ab4db27214cd13598", "sha256": "39bee58687a4f9b4f095af607b8e57888bf7b80e7048a37caf09aaaa2262f19b" }, "downloads": -1, "filename": "reflectivipy-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0c22c30bacb1cb0ab4db27214cd13598", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13737, "upload_time": "2019-06-07T21:25:15", "url": "https://files.pythonhosted.org/packages/c0/cd/24b160d22df0570136e6d902bd7483d7b9299fe9e2fbe1431d2eed8da3f0/reflectivipy-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a08d72c8eab8c75c448b90237cf565b8", "sha256": "1b5352b8ea3b1b6d93ac4adb223f7122fb73d376f4ee8c55e9e55f4eabfc6d30" }, "downloads": -1, "filename": "reflectivipy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a08d72c8eab8c75c448b90237cf565b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10209, "upload_time": "2019-06-07T21:25:16", "url": "https://files.pythonhosted.org/packages/a7/1e/2f53db42ba0ccdf7bc1e0e592c5f14dafc404632b1b67d1171e6e7ea76ad/reflectivipy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "056f23607d234cb8faf143db4ee30d9d", "sha256": "08fc7ec6b76186e06ddc4058e9f30066977cd9ef2951fc224f48988fc415813a" }, "downloads": -1, "filename": "reflectivipy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "056f23607d234cb8faf143db4ee30d9d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13737, "upload_time": "2019-06-07T21:33:20", "url": "https://files.pythonhosted.org/packages/14/e1/b1ef3b9857b57d3ba266753342c0748a96fc28ff3c489acf969e17e5ca8f/reflectivipy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b82e2e2e73ec717ce26e8a05ae67a589", "sha256": "db3f85f28845fe3ef977ff07c6501f26a5c697015c0dd194cf7b8c8831485ae3" }, "downloads": -1, "filename": "reflectivipy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b82e2e2e73ec717ce26e8a05ae67a589", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10217, "upload_time": "2019-06-07T21:33:21", "url": "https://files.pythonhosted.org/packages/1e/71/fa571718677f557037dd5890457e9b72bf43e28116e904d93fb07ae71ead/reflectivipy-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "056f23607d234cb8faf143db4ee30d9d", "sha256": "08fc7ec6b76186e06ddc4058e9f30066977cd9ef2951fc224f48988fc415813a" }, "downloads": -1, "filename": "reflectivipy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "056f23607d234cb8faf143db4ee30d9d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13737, "upload_time": "2019-06-07T21:33:20", "url": "https://files.pythonhosted.org/packages/14/e1/b1ef3b9857b57d3ba266753342c0748a96fc28ff3c489acf969e17e5ca8f/reflectivipy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b82e2e2e73ec717ce26e8a05ae67a589", "sha256": "db3f85f28845fe3ef977ff07c6501f26a5c697015c0dd194cf7b8c8831485ae3" }, "downloads": -1, "filename": "reflectivipy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b82e2e2e73ec717ce26e8a05ae67a589", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10217, "upload_time": "2019-06-07T21:33:21", "url": "https://files.pythonhosted.org/packages/1e/71/fa571718677f557037dd5890457e9b72bf43e28116e904d93fb07ae71ead/reflectivipy-0.1.1.tar.gz" } ] }