{ "info": { "author": "Nicolas M. Thi\u00e9ry", "author_email": "nthiery@users.sf.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Build Tools" ], "description": "Recursive monkey patching for Python\n====================================\n\n.. image:: https://travis-ci.org/nthiery/recursive-monkey-patch.svg?branch=master\n :target: https://travis-ci.org/nthiery/recursive-monkey-patch\n\nMotivating use case\n-------------------\n\nLet ``foo`` be a Python package, built on top of another Python\npackage ``bar``. Sometimes ``foo`` may wish to extend the ``bar``\npackage by adding features (e.g. methods) to existing classes or\nmodules. Sometimes the whole package is meant as a temporary location\nwhere experimental features can mature and be distributed early until\nthey get merged into the ``bar`` package.\n\nIn such cases, it's desirable to write the source code of those\nfeatures as closely as if they were in the ``bar`` package.\n\n``recursive-monkey-patch`` enables this by providing a tool to\nrecursively monkey patch the ``bar`` package. Let's assume for example\nthat we are writing a package ``bar-foo`` that requires the addition\nof a method ``f`` to the class ``bar.x.y.z.Z``.\n\nTo achieve this, one writes a module ``foo.x.y.z.Z`` containing a\ndummy ``Z`` class::\n\n class Z:\n def f(self):\n return \"f\"\n\nAnd then, upon initializing the package, one runs::\n\n import bar\n import foo\n from recursive_monkey_patch import monkey_patch\n monkey_patch(foo, bar)\n\nwhich will recursively crawl through ``foo``, and insert methods like\n``f`` at the corresponding location in ``bar``. If a class or module\nin ``foo`` does not exist in ``bar``, then the module is inserted at\nthe corresponding location in ``bar``\n\nRelation with SageMath\n----------------------\n\nThis package is primarily meant for writing (experimental) packages on\ntop of `SageMath `_, an open source software for\nmathematics that includes a large Python library. However, the\ndependency upon the ``SageMath`` package is actually light:\n\n- Running the doctests requires ``sage``;\n- When the SageMath package is present, the monkey patching involves a\n few additional Sage specific hacks.\n\nToDo\n----\n\n- Support for lazy imports\n- Where is the natural place for running ``monkey_patch` in a package?\n\nRelated tools\n-------------\n\n- `patchy `_: runtime application of source patches at the granularity of functions\n- `unittest.mock.patch `_: temporary runtime monkey patching of functions; meant primarily for testing purposes \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/nthiery/recursive-monkey-patch", "keywords": "packaging development", "license": "GPLv2+", "maintainer": "", "maintainer_email": "", "name": "recursive-monkey-patch", "package_url": "https://pypi.org/project/recursive-monkey-patch/", "platform": "", "project_url": "https://pypi.org/project/recursive-monkey-patch/", "project_urls": { "Homepage": "https://github.com/nthiery/recursive-monkey-patch" }, "release_url": "https://pypi.org/project/recursive-monkey-patch/0.4.0/", "requires_dist": null, "requires_python": "", "summary": "Recursive Monkey Patching", "version": "0.4.0" }, "last_serial": 4183860, "releases": { "0.1.0": [], "0.1.1": [ { "comment_text": "", "digests": { "md5": "23552bd314056fb30f36b2214e897c8b", "sha256": "e7e3dab0ab7341ab502b7266d62003a12b0180267f84d2f18fa29e0d56a0321b" }, "downloads": -1, "filename": "recursive_monkey_patch-0.1.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "23552bd314056fb30f36b2214e897c8b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6759, "upload_time": "2016-05-23T13:10:47", "url": "https://files.pythonhosted.org/packages/2a/d4/e82f4167040e25292c25890101eab64b62cad2acbc159505a86d81de83bc/recursive_monkey_patch-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ab9f25d3c35e7169cae996c7a5eb78ad", "sha256": "a7c56a2e16fc6b9a2d38d72e41bec5ea6460ab311479da82d6e1c95f62923bc3" }, "downloads": -1, "filename": "recursive-monkey-patch-0.1.1.tar.gz", "has_sig": true, "md5_digest": "ab9f25d3c35e7169cae996c7a5eb78ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4706, "upload_time": "2016-05-23T13:11:05", "url": "https://files.pythonhosted.org/packages/15/8e/f1d535fc71b26593b903dc5364ac7213aa005ebd08093f3d779d82e96002/recursive-monkey-patch-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "234c75f53aed0a0ae7cc7f6fd6907e5a", "sha256": "1188d210e44f25d87e1ff22fb09b5f4ee5b209c9cc03b5e051901e37d8ab29fc" }, "downloads": -1, "filename": "recursive_monkey_patch-0.2.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "234c75f53aed0a0ae7cc7f6fd6907e5a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7510, "upload_time": "2016-05-24T23:12:01", "url": "https://files.pythonhosted.org/packages/9c/eb/6e3c41d1bb15228c519bb3a86a76c75f8392df5cd556b4016a4513ea17f2/recursive_monkey_patch-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "af74b90515407ab61784095d5b211f0e", "sha256": "b2b73ff28ce22f2de496c22eb42b545f43102e63afd0e38b12c2edcd2ef7f170" }, "downloads": -1, "filename": "recursive-monkey-patch-0.2.0.tar.gz", "has_sig": true, "md5_digest": "af74b90515407ab61784095d5b211f0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6069, "upload_time": "2016-05-24T23:13:02", "url": "https://files.pythonhosted.org/packages/7f/7b/69524f2ddd6844c6294549b5c2986ed96b243861efb09144eb757e1cae46/recursive-monkey-patch-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "43e442307a60d9a441e4b8486f774a55", "sha256": "e1a87bd17ace27c9e25b42c377dc7f8e4abefb09920792921fd44c65d746900a" }, "downloads": -1, "filename": "recursive_monkey_patch-0.3.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "43e442307a60d9a441e4b8486f774a55", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7812, "upload_time": "2016-11-23T22:43:51", "url": "https://files.pythonhosted.org/packages/3b/67/d0dc0df5d0dd0fd1bce434c6b903058896e64d914d27f966d20db9f557c5/recursive_monkey_patch-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a0a67a0f6496200df4eeb5abe1577f02", "sha256": "14d51afa40ba3483916dbd999568dc1a63086e09a750d8a857cbf241985b8dea" }, "downloads": -1, "filename": "recursive-monkey-patch-0.3.0.tar.gz", "has_sig": true, "md5_digest": "a0a67a0f6496200df4eeb5abe1577f02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6602, "upload_time": "2016-11-23T22:44:00", "url": "https://files.pythonhosted.org/packages/ba/27/a44a98292e3ba852f6f1af4416bd603d7baa0893158d6c803870ebe071c1/recursive-monkey-patch-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "3de67c5760aedfe633c17047a4fe4966", "sha256": "98922554e77f2e2c85a4f5d873a0f52efdc1b553f32444bd6c788b2ff583bf3e" }, "downloads": -1, "filename": "recursive_monkey_patch-0.4.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "3de67c5760aedfe633c17047a4fe4966", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8574, "upload_time": "2018-08-18T21:14:26", "url": "https://files.pythonhosted.org/packages/4b/96/4c122e0340033c57b2107c640dfd8e70f66bdbe5a86d389fdc2318ee2647/recursive_monkey_patch-0.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "24376711dc5c6d7ff4e986f6ec6eab5a", "sha256": "546739fea5be2ea9f98b5ec44fafeb697b5cf9fdcda64a03422582ab03ee24c4" }, "downloads": -1, "filename": "recursive-monkey-patch-0.4.0.tar.gz", "has_sig": true, "md5_digest": "24376711dc5c6d7ff4e986f6ec6eab5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7230, "upload_time": "2018-08-18T21:14:28", "url": "https://files.pythonhosted.org/packages/8c/7c/4e196cf7994830c151eb404f49dc43b403927affd6861f720d9c576f9733/recursive-monkey-patch-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3de67c5760aedfe633c17047a4fe4966", "sha256": "98922554e77f2e2c85a4f5d873a0f52efdc1b553f32444bd6c788b2ff583bf3e" }, "downloads": -1, "filename": "recursive_monkey_patch-0.4.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "3de67c5760aedfe633c17047a4fe4966", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8574, "upload_time": "2018-08-18T21:14:26", "url": "https://files.pythonhosted.org/packages/4b/96/4c122e0340033c57b2107c640dfd8e70f66bdbe5a86d389fdc2318ee2647/recursive_monkey_patch-0.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "24376711dc5c6d7ff4e986f6ec6eab5a", "sha256": "546739fea5be2ea9f98b5ec44fafeb697b5cf9fdcda64a03422582ab03ee24c4" }, "downloads": -1, "filename": "recursive-monkey-patch-0.4.0.tar.gz", "has_sig": true, "md5_digest": "24376711dc5c6d7ff4e986f6ec6eab5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7230, "upload_time": "2018-08-18T21:14:28", "url": "https://files.pythonhosted.org/packages/8c/7c/4e196cf7994830c151eb404f49dc43b403927affd6861f720d9c576f9733/recursive-monkey-patch-0.4.0.tar.gz" } ] }