{ "info": { "author": "Ben Samuel", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Build Tools" ], "description": "Imperative modifications of immutable collections\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nOverview\n========\n\nThe `pyrsistent-mutable` package presents a decorator that will transform a decorated function to use the\n`pyrsistent `_ API.\n\nThis means that a set of specific operations are transformed:\n\n* Construction of literal ``set``\\s, ``dict``\\s and ``list``\\s are transformed into calls to ``pset``\\, ``pvector``\n and ``pmap``\\.\n* Assignments are rewritten to handle:\n * Assignments to attributes become evolve calls; nesting is handled correctly.\n * Augmented assignments are transformed into regular assignments.\n* Standalone method invocations are transformed into assignments.\n\n.. code-block:: python\n\n from pyrsistent_mutable import pyrmute\n from pyrsistent import PRecord, field\n\n class Simple(PRecord):\n attr = field()\n other = field()\n\n @pyrmute\n def example_func():\n # Built in referential integrity\n save_vector = my_vector = [0, 1, 2, 3, 4] # Mapped to a pvector\n del my_vector[3] # Does *not* change save_vector\n\n # Evolve nested attributes\n my_precord = Simple(attr=Simple(), other=[])\n my_precord.attr.attr = 5\n my_precord.other.append(20)\n\n # Transforms literals and comprehensions\n my_maps = [{'filling': key} for key in ('apple', 'banana')]\n my_maps[0]['crust'] = 'flaky'\n\n return my_vector, save_vector, my_precord, my_maps\n\n*This example is tested in* ``tests/test_readme.py``\\.\n\nWhat's the point?\n-----------------\n\nIt's entirely that the imperative form is easier to read, and that pyrsistent's API is tedious for nested collections,\nat least compared to native Python syntax.\n\nAlso, I'm working on a language that uses this technique more extensively, so this was an opportunity to turn a\nprototype into something more generally useful.\n\nInstalling\n----------\n\nInstallation should just be:\n\n.. code-block:: bash\n\n # Install via pip, preferred.\n pip3 install pyrsistent-mutable\n\n # Install traditionally.\n python3 setup.py install\n\nUsage\n-----\n\nBeyond the example shown above, the main things to keep in mind when using this module:\n\n* You function still needs to return values.\n* A \"copy\" can be made by simple assignment.\n* Lists, dicts and sets literals and comprehensions are transformed.\n* Tuples are *not* transformed, nor are generators.\n* Method calls are *only* transformed if they are standalone expressions.\n* Rewritten operations should fall back to normal behavior for non-`pyrsistent` values.\n* The decorated function can't allow ``nonlocal`` names.\n* ``global`` may not work.\n\nTroubleshooting\n===============\n\nThis is really just trying to take a prototype and do something useful with it.\n\nIf a function isn't calling something in a useful manner, the culprit is probably my very lame implementations in\n``pyrsistent_mutable.globals``.\n\nDon't forget to ``return``\n--------------------------\n\nThis only munges assignments and expression statements.\n\nRead the ``__source__``\n-----------------------\n\nThe transformed code is written into your function under ``__source__`` which may be helpful in debugging.\n\nKnown limits\n------------\n\nMost of these are because I've only done very preliminary work to map imperative operations to pyrsistent values.\n\n* Assignment of slices uses the evolver framework, which doesn't handle complex slices.\n* Deletion of slices similarly doesn't work.\n* Augmented assignment generally requires a pyrsistent value on the rhs.\n * This is mitigated now that the module translates literals.\n* It is not tested on asynchronous functions or generators. It shouldn't care about them, though.\n* It's all or nothing.\n* The top level function can't have ``nonlocal`` names. Embedded functions can, though.\n\nDebugging\n---------\n\nBy default, the decorator will write the transformed source to your function as ``__source__``\\. I just pulled that name\nout my hat. You can call the decorator with ``write_source=False`` to disable this.\n\nPackage maintainer notes\n========================\n\n.. code-block:: bash\n\n pip install twine\n python setup.py bdist_wheel\n twine upload dist/pyrsistent_mutable-0.0.x-py3-none-any.whl\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/scooby/pyrsistent-mutable", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyrsistent-mutable", "package_url": "https://pypi.org/project/pyrsistent-mutable/", "platform": "", "project_url": "https://pypi.org/project/pyrsistent-mutable/", "project_urls": { "Homepage": "https://github.com/scooby/pyrsistent-mutable" }, "release_url": "https://pypi.org/project/pyrsistent-mutable/0.0.6/", "requires_dist": [ "pyrsistent", "astunparse", "six" ], "requires_python": "~=3.4", "summary": "Decorator to create and update immutable values with imperative syntax.", "version": "0.0.6" }, "last_serial": 3636667, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "5d7772a7a6d573f8a153171a21d75c5f", "sha256": "3f8b48786ff37a1fc595cfc59f95b4cf02bf9cbad0aca0e9847ac52c2139d20f" }, "downloads": -1, "filename": "pyrsistent_mutable-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5d7772a7a6d573f8a153171a21d75c5f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 7757, "upload_time": "2018-01-15T21:28:56", "url": "https://files.pythonhosted.org/packages/94/a6/2705c9e8b8c177c8a59b4df70ad86ba55005d7a9e6e28be2c590ac8c2910/pyrsistent_mutable-0.0.1-py3-none-any.whl" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "320548db02dbe382706ab1a03c68fe98", "sha256": "47ef5c20f7706db2fb58d3a364a326c2d6176c4e0709d5732c5b436bb1d13a13" }, "downloads": -1, "filename": "pyrsistent_mutable-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "320548db02dbe382706ab1a03c68fe98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 13212, "upload_time": "2018-03-03T21:10:04", "url": "https://files.pythonhosted.org/packages/6f/2b/1903c6fbfb3b01c8f55ad8128625cc316d3f26812d86bb7516aa79047a58/pyrsistent_mutable-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "d6c29ab4602aed15bb9c8f5e77acecb6", "sha256": "946af959528576eeda914b126e4c12f5625f31cd80e1d4df9996d2ee01692d25" }, "downloads": -1, "filename": "pyrsistent_mutable-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "d6c29ab4602aed15bb9c8f5e77acecb6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 14688, "upload_time": "2018-03-03T23:55:39", "url": "https://files.pythonhosted.org/packages/27/4d/0cd53a68e3e0cd43c5154b1ab6802fcc0afebc2750bc79aa0f62ac84f6f0/pyrsistent_mutable-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "09fb7545db37f2a7ce587a26f7aabbb6", "sha256": "0db298ad2d5b47291c5c532728a4109b742944e354ba28b0d8cca92a83611545" }, "downloads": -1, "filename": "pyrsistent_mutable-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "09fb7545db37f2a7ce587a26f7aabbb6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 15449, "upload_time": "2018-03-04T01:16:55", "url": "https://files.pythonhosted.org/packages/24/d0/59a9be62331c4abda623a418db0089846256f3c5ba4249841846e2ba5a9d/pyrsistent_mutable-0.0.5-py3-none-any.whl" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "c3b54497a28f8574284002ef2759bd34", "sha256": "1434aaa3a01a2fabb27d436d1100dfaa8ff12ee8207077582352023c41cd5667" }, "downloads": -1, "filename": "pyrsistent_mutable-0.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "c3b54497a28f8574284002ef2759bd34", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "~=3.4", "size": 13952, "upload_time": "2018-03-04T05:39:20", "url": "https://files.pythonhosted.org/packages/1a/68/f316bf5063b3cc74c74101a3ec943f91d2c79e9b8924275ef0f9098ea295/pyrsistent_mutable-0.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2394e2e4e4e5336d2b58d9a5c7067109", "sha256": "5426d8e1a68101c814c9e270b4b6870f4180aeb141aeefe26f39f66e44846dbf" }, "downloads": -1, "filename": "pyrsistent_mutable-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "2394e2e4e4e5336d2b58d9a5c7067109", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 13915, "upload_time": "2018-03-04T05:39:22", "url": "https://files.pythonhosted.org/packages/62/50/845e7c980521eef391ddb8720c69b80ebadc8a0826baa323e8e743be28de/pyrsistent_mutable-0.0.6-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c3b54497a28f8574284002ef2759bd34", "sha256": "1434aaa3a01a2fabb27d436d1100dfaa8ff12ee8207077582352023c41cd5667" }, "downloads": -1, "filename": "pyrsistent_mutable-0.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "c3b54497a28f8574284002ef2759bd34", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "~=3.4", "size": 13952, "upload_time": "2018-03-04T05:39:20", "url": "https://files.pythonhosted.org/packages/1a/68/f316bf5063b3cc74c74101a3ec943f91d2c79e9b8924275ef0f9098ea295/pyrsistent_mutable-0.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2394e2e4e4e5336d2b58d9a5c7067109", "sha256": "5426d8e1a68101c814c9e270b4b6870f4180aeb141aeefe26f39f66e44846dbf" }, "downloads": -1, "filename": "pyrsistent_mutable-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "2394e2e4e4e5336d2b58d9a5c7067109", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 13915, "upload_time": "2018-03-04T05:39:22", "url": "https://files.pythonhosted.org/packages/62/50/845e7c980521eef391ddb8720c69b80ebadc8a0826baa323e8e743be28de/pyrsistent_mutable-0.0.6-py3-none-any.whl" } ] }