{ "info": { "author": "Michael Torpey", "author_email": "mct25@st-andrews.ac.uk", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "pypersist\n=========\n\n[](https://travis-ci.org/mtorpey/pypersist)\n[](https://codecov.io/gh/mtorpey/pypersist)\n[](https://pypersist.readthedocs.io/en/latest/?badge=latest)\n[](https://badge.fury.io/py/pypersist)\n[](https://mybinder.org/v2/gh/mtorpey/pypersist/master?filepath=binder/demo.ipynb)\n\npypersist is a persistent memoisation framework for Python 2 and 3. Persistent\nmemoisation is the practice of storing the output of a function permanently to a\ndisk or a server so that the result can be looked up automatically in the\nfuture, avoiding any known results being recomputed unnecessarily.\n\nInstallation\n------------\npypersist is available from PyPI, and the latest release can be installed using,\nfor example:\n\n pip3 install --user pypersist\n\nAlternatively, the latest development version can be installed using Github:\n\n git clone https://github.com/mtorpey/pypersist.git\n pip3 install --user ./pypersist\n\nExamples\n--------\nTo use, import the `persist` class from the `pypersist` package:\n\n```python\nfrom pypersist import persist\n```\n\nand use it as a decorator when writing a function:\n\n```python\n@persist\ndef double(x):\n return x * 2\n\nprint(double(3))\nprint(double(6.5))\n```\n\nThis will store the outputs of the `double` function in a directory called\n`persist/double/`, in a machine-readable format.\n\nOne can specify various arguments to `persist`. For example:\n\n```python\n@persist(key=lambda x,y: (x,y),\n hash=lambda k: '%s_to_the_power_of_%s' % k,\n pickle=str,\n unpickle=int)\ndef power(x, y):\n return x ** y\n\nprint(power(2,4))\nprint(power(10,5))\n```\n\nwill store the outputs of `power` in human-readable files with descriptive\nfilenames.\n\nMany more options are available. See the `persist` class documentation for a\nfull description, or [launch the included notebook on\nBinder](https://mybinder.org/v2/gh/mtorpey/pypersist/master?filepath=binder/demo.ipynb)\nfor more examples.\n\nSee [this HackMD](https://hackmd.io/1M5clex-TYWCuxxgi05k5A) and the Issue\ntracker for current plans.\n\nCiting\n------\nPlease cite this package as:\n\n[Tor19] \nM. Torpey, \npypersist, \nPython memoisation framework,\nVersion X.Y (20XX),\nhttps://github.com/mtorpey/pypersist.\n\nAcknowledgements\n----------------\npypersist was created as part of the OpenDreamKit project: \nhttps://opendreamkit.org/\n\nThis part of the project is summarised in [this report](https://github.com/OpenDreamKit/OpenDreamKit/blob/master/WP6/D6.9/report-final.pdf).\n\n
| \n | \n\n This infrastructure is part of a project that has received funding from the\n European Union's Horizon 2020 research and innovation programme under grant\n agreement No 676541.\n | \n