{ "info": { "author": "Sean Stewart", "author_email": "sean_stewart@me.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Utilities", "Typing :: Typed" ], "description": "reckon: Dead-simple, dynamic memoization\n==============================================================================\n[![image](https://img.shields.io/pypi/v/reckon.svg)](https://pypi.org/project/reckon/)\n[![image](https://img.shields.io/pypi/l/reckon.svg)](https://pypi.org/project/reckon/)\n[![image](https://img.shields.io/pypi/pyversions/reckon.svg)](https://pypi.org/project/reckon/)\n[![image](https://img.shields.io/github/languages/code-size/seandstewart/reckon.svg?style=flat)](https://github.com/seandstewart/reckon)\n[![image](https://img.shields.io/travis/seandstewart/reckon.svg)](https://travis-ci.org/seandstewart/reckon)\n[![codecov](https://codecov.io/gh/seandstewart/reckon/branch/master/graph/badge.svg)](https://codecov.io/gh/seandstewart/reckon)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n## Installation\n\nIn order to install the latest version, simply `pip3 install\n-U reckon`.\n\nThis library requires Python 3.6 or greater.\n\n\n## What is it?\n`reckon` implements a dynamic LRU cache by automatically\nmonitoring the memory usage of your machine and purging\nentries as it approaches a pre-defined ratio (defaults to\n90%).\n\n`reckon` is largely inspired by the `global_lru_cache`\npackage, so credit should be given for the initial\nimplementation. This package brings those ideas into python3\nand adds a local cache implementation as well.\n\n\n## Usage\nUsage is simple:\n\n```python\nimport reckon\n\n@reckon.memoize\ndef some_expensive_func(foo: int, bar: int):\n return foo ** bar\n```\n\n`reckon` will automatically make use of the global cache. \n\nWhile the global cache is automatically maintained, it may\nbe necessary to managed the cache manually. To that purpose,\nreckon provides the following global methods:\n- `reckon.glob.clear`: Clear the global cache.\n- `reckon.glob.shrink`: Shrink the global cache.\n- `reckon.glob.usage`: Check the current usage ratio.\n- `reckon.glob.set_usage`: Set the max memory usage ratio\n for the global cache.\n- `reckon.glob.info`: View high-level information about the\n cache - similar to `functools.lru_cache.cache_info`\n\nIf you wish to only maintain a cache local to a function you\ncan simply pass a flag to the decorator:\n\n```python\nimport reckon\n\n@reckon.memoize(locale=\"local\")\ndef some_expensive_func(foo: int, bar: int):\n return foo ** bar\n```\n\nAdditionally, if you wish to maintain a cache local to a\nmodule, you can initialize your own instance of the\n`LocalCache` object:\n\n```python\nimport reckon\n\ncache = reckon.local()\n\n@cache.memoize\ndef some_expensive_func(foo: int, bar: int):\n return foo ** bar\n```\n\nThe local cache instance maintains the same high-level API\nfor management as the global cache:\n\n- `LocalCache.clear`: Clear the local cache.\n- `LocalCache.shrink`: Shrink the local cache.\n- `LocalCache.usage`: Check the current usage ratio.\n- `LocalCache.set_usage`: Set the max memory usage ratio for\n the local cache.\n- `LocalCache.info`: View high-level information about the\n cache - similar to `functools.lru_cache.cache_info`\n\nAll memoized functions have introspection into their cache\nvia the `cache` attribute.\n\n## Documentation\n\nFull documentation coming soon!\n\n\n## How to Contribute\n1. Check for open issues or open a fresh issue to start a \n discussion around a feature idea or a bug.\n2. Create a branch on Github for your issue or fork\n [the repository](https://github.com/seandstewart/reckon)\n on GitHub to start making your changes to the **master**\n branch.\n3. Write a test which shows that the bug was fixed or that \n the feature works as expected.\n4. Send a pull request and bug the maintainer until it gets\n merged and published. :)\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/seandstewart/reckon", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "reckon", "package_url": "https://pypi.org/project/reckon/", "platform": "", "project_url": "https://pypi.org/project/reckon/", "project_urls": { "Homepage": "https://github.com/seandstewart/reckon" }, "release_url": "https://pypi.org/project/reckon/0.2.0/", "requires_dist": [ "psutil" ], "requires_python": ">=3.6", "summary": "reckon: Dead simple, dynamic caching.", "version": "0.2.0" }, "last_serial": 5465609, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "110def4507cfacec07d87b2e3ccc8d74", "sha256": "f116a516a73f62df710346c7ebfe0bd6362a502ea5a95ca0df21dfab9437e64b" }, "downloads": -1, "filename": "reckon-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "110def4507cfacec07d87b2e3ccc8d74", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 8232, "upload_time": "2019-06-26T17:49:56", "url": "https://files.pythonhosted.org/packages/bf/3c/64d15942376092bd7853874dd51f6fb48184549c2202ed8c3b9c61c8ab38/reckon-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "db624674ff4b550c9527d999a20e88a1", "sha256": "943d37a63cd241dc71834086abe5c0c10c52f0a8592e47ae747e93693aad546f" }, "downloads": -1, "filename": "reckon-0.1.0.tar.gz", "has_sig": false, "md5_digest": "db624674ff4b550c9527d999a20e88a1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7626, "upload_time": "2019-06-26T17:49:58", "url": "https://files.pythonhosted.org/packages/7e/d4/a25b05e5d034fc63903409e1db34a9a95fa64d0d67c63caf762f790acadc/reckon-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d5d92a803dda38fe86596c534827c5ff", "sha256": "96668cf661779afbfc65a5b519abe0628fe942bc77e7a4009a05f4c4518049db" }, "downloads": -1, "filename": "reckon-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d5d92a803dda38fe86596c534827c5ff", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 8389, "upload_time": "2019-06-26T18:06:24", "url": "https://files.pythonhosted.org/packages/39/d1/d4f02bea5f7fd6c3899192ea5bd16ee5629b1121f8aa2c1aad38edf358dd/reckon-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "21287c3fdffeb8e3432c4b7b3f152188", "sha256": "744dd92d14396ce16262c6c6aa8054e1c0b866e077d3c6899f42eee5a765a894" }, "downloads": -1, "filename": "reckon-0.1.1.tar.gz", "has_sig": false, "md5_digest": "21287c3fdffeb8e3432c4b7b3f152188", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7800, "upload_time": "2019-06-26T18:06:25", "url": "https://files.pythonhosted.org/packages/a1/4e/101505af9331b5dd8de7dbaf8ea6e1adc4dc46154e89b2264aa779920866/reckon-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "12164ae504e7235aa00bcf3eeb150ff8", "sha256": "d1d91dfd338b95e91b76808641bc37fb8c12b7c5ae9cc116ba96a18ee0ab5d38" }, "downloads": -1, "filename": "reckon-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "12164ae504e7235aa00bcf3eeb150ff8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 8347, "upload_time": "2019-06-26T18:11:20", "url": "https://files.pythonhosted.org/packages/d9/e3/b800b9998837599dc64447e371abc241f4c3a8b806a02af9c918e1f4df22/reckon-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f5bc50596796117ea80b5eb7d53f0e83", "sha256": "dd116c3eee5fbd3d3aab0fbabb11fcb8ad939e7a7bef18be26b59a977c939a1b" }, "downloads": -1, "filename": "reckon-0.1.2.tar.gz", "has_sig": false, "md5_digest": "f5bc50596796117ea80b5eb7d53f0e83", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7726, "upload_time": "2019-06-26T18:11:22", "url": "https://files.pythonhosted.org/packages/e5/a0/a494db58e0a1b6f94b4a5e40a821514e6e4cad96bd6b71a6bcaa0e4f4445/reckon-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "327d25e4d0e23f60675b01497fd0b37f", "sha256": "1812389b46f46cf8fa96654a798c43495ef50cd155cc3e90b7c24929c628c7b6" }, "downloads": -1, "filename": "reckon-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "327d25e4d0e23f60675b01497fd0b37f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 8697, "upload_time": "2019-06-29T14:58:54", "url": "https://files.pythonhosted.org/packages/0f/4f/723513cac87843ab2387c699d61ceecbc23ba98eab3c19c2ab1b21cd33e0/reckon-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7dd075baa9659ccf8075bf58747c2e7b", "sha256": "e6133d72a076869ad7f46f8aee12277d3f0d874ad4eae0a05fe33f6536dde027" }, "downloads": -1, "filename": "reckon-0.2.0.tar.gz", "has_sig": false, "md5_digest": "7dd075baa9659ccf8075bf58747c2e7b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 8223, "upload_time": "2019-06-29T14:58:55", "url": "https://files.pythonhosted.org/packages/ac/a6/8e339445d9b11e30d57fd764b3082a006d4d093215787f12a6a6bfc9cd96/reckon-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "327d25e4d0e23f60675b01497fd0b37f", "sha256": "1812389b46f46cf8fa96654a798c43495ef50cd155cc3e90b7c24929c628c7b6" }, "downloads": -1, "filename": "reckon-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "327d25e4d0e23f60675b01497fd0b37f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 8697, "upload_time": "2019-06-29T14:58:54", "url": "https://files.pythonhosted.org/packages/0f/4f/723513cac87843ab2387c699d61ceecbc23ba98eab3c19c2ab1b21cd33e0/reckon-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7dd075baa9659ccf8075bf58747c2e7b", "sha256": "e6133d72a076869ad7f46f8aee12277d3f0d874ad4eae0a05fe33f6536dde027" }, "downloads": -1, "filename": "reckon-0.2.0.tar.gz", "has_sig": false, "md5_digest": "7dd075baa9659ccf8075bf58747c2e7b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 8223, "upload_time": "2019-06-29T14:58:55", "url": "https://files.pythonhosted.org/packages/ac/a6/8e339445d9b11e30d57fd764b3082a006d4d093215787f12a6a6bfc9cd96/reckon-0.2.0.tar.gz" } ] }