{ "info": { "author": "Bjoern Juergens", "author_email": "juergens@teco.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: IPython", "Framework :: Jupyter", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: Other/Proprietary License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "cache magic\n===========\n\nThis package adds ``%cache`` line-magic to ipython kernels in jupyter\nnotebooks.\n\nQuickstart\n----------\n\n- The pip-package is called ``ipython-cache``\n- The python module is called ``cache_magic``\n- The magic is called ``%cache``\n\nSo you can run the magic by entering this into an ipython-cell:\n\n.. code:: python\n\n !pip install ipython-cache\n import cache_magic\n %cache a = 1+1\n %cache\n\ninstallation\n============\n\ninstall directly from notebook\n------------------------------\n\n1. open jupyter notebook\n2. create new cell\n3. enter ``!pip install cache-magic``\n4. execute\n\ninstall into conda-environment\n------------------------------\n\n.. code:: bash\n\n conda create -n test\n source activate test\n conda install -c juergens ipython-cache\n jupyter notebook\n\nusage\n=====\n\nActivate the magic by loading the module like any other module. Write\ninto a cell ``import cache_magic`` and excecute it.\n\nWhen you want to apply the magic to a line, just prepend the line with\n``%cache``\n\nexample\n-------\n\n::\n\n %cache myVar = someSlowCalculation(some, \"parameters\")\n\nThis will calculate ``someSlowCalculation(some, \"parameters\")`` once.\nAnd in subsequent calls it restores myVar from storage.\n\nThe magic turns this example into something like this (if there was no\nipython-kernel and no versioning):\n\n.. code:: python\n\n try:\n with open(\"myVar.txt\", 'rb') as fp:\n myVar = pickle.loads(fp.read())\n except:\n myVar = someSlowCalculation(some, \"parameters\")\n with open(\"myVar.txt\", 'wb') as fp:\n pickle.dump(myVar, fp)\n\ngeneral form\n------------\n\n::\n\n %cache = \n\n**Variable**: This Variable\u2019s value will be fetched from cache.\n\n**Expression**: This will only be excecuted once and the result will be\nstored to disk.\n\nfull form\n---------\n\n::\n\n %cache [--version ] [--reset] [--debug] variable [= ]\n\n**-v or \u2013version**: either a variable name or an integer. Whenever this\nchanges, a new value is calculated (instead of returning an old value\nfrom the cache).\n\nif version is \u2018\\*\u2019 or omitted, the hashed expression is used as version,\nso whenever the expression changes, a new value is cached.\n\n**-r or \u2013reset**: delete the cached value for this variable. Forces\nrecalculation, if ```` is present\n\n**-d or \u2013debug**: additional logging\n\nshow cache\n----------\n\n.. code:: python\n\n %cache\n\nshows all variables in cache as html-table\n\nfull reset\n----------\n\n.. code:: python\n\n %cache -r\n %cache --reset\n\ndeletes all cached values for all variables\n\nwhere is the cache stored?\n--------------------------\n\nIn the directory where the kernel was started (usually where the\nnotebook is located) in a subfolder called ``.cache_magic``\n\ndeveloper Notes\n===============\n\npush to pypi\n------------\n\nprepare environment:\n\n.. code:: bash\n\n gedit ~/.pypirc\n chmod 600 ~/.pypirc\n sudo apt install pandoc\n\nupload changes to test and production:\n\n.. code:: bash\n\n pandoc -o README.rst README.md\n restview --pypi-strict README.rst\n # update version in setup.py\n rm -r dist\n python setup.py sdist\n twine upload dist/* -r testpypi\n firefox https://testpypi.python.org/pypi/ipython-cache\n twine upload dist/*\n\ntest install from testpypi\n\n.. code:: bash\n\n pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple ipython_cache --no-cache-dir --user\n\ntest installation\n\n.. code:: bash\n\n sudo pip install ipython_cache --no-cache-dir --user\n\neditable import\n---------------\n\nInstall into environment with ``-e``:\n\n.. code:: python\n\n !pip install -e .\n\nreload after each change:\n\n.. code:: bash\n\n import cache_magic\n from imp import reload\n reload(cache_magic)\n\nAlternatively (if you don\u2019t want to install python, jupyter & co), you\ncan use the docker-compose.yml for development:\n\n.. code:: bash\n\n cd ipython-cache\n docker-compose up\n\ncreate Conda Packet\n-------------------\n\nrequires the bash with latest anaconda on path\n\n.. code:: bash\n\n bash\n mkdir test && cd test\n conda skeleton pypi ipython-cache\n conda-build ipython-cache -c conda-forge\n anaconda upload /home/juergens/anaconda3/conda-bld/linux-64/ipython-cache-*\n\nrunning tests\n-------------\n\n.. code:: bash\n\n bash\n conda remove --name test --all\n conda env create -f test/environment.yml\n source activate test\n conda remove ipython-cache\n pip uninstall ipython_cache\n pip install -e .\n ./test/run_example.py\n\nIf there is any error, it will be printed to stderr and the script\nfails.\n\nthe output can be found in \u201ctest/temp\u201d.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SmartDataInnovationLab/ipython-cache", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ipython-cache", "package_url": "https://pypi.org/project/ipython-cache/", "platform": "", "project_url": "https://pypi.org/project/ipython-cache/", "project_urls": { "Homepage": "https://github.com/SmartDataInnovationLab/ipython-cache" }, "release_url": "https://pypi.org/project/ipython-cache/0.2.6/", "requires_dist": null, "requires_python": "", "summary": "versatile cache line magic for ipython", "version": "0.2.6" }, "last_serial": 3523927, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "1ac5f693b628dfb418975d86685d4464", "sha256": "d1456b39a2d12cb6fe22a23046ade4709dfcbd6a235509de94328eebef8a8c86" }, "downloads": -1, "filename": "ipython-cache-0.2.tar.gz", "has_sig": false, "md5_digest": "1ac5f693b628dfb418975d86685d4464", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5244, "upload_time": "2018-01-25T16:13:34", "url": "https://files.pythonhosted.org/packages/c0/66/8eb30e2cdf7c2b22baaa7b154b054fc2ef4ad244a7a36a350e89498f4dc8/ipython-cache-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "84528671773431a7aec9f92f689c2fb1", "sha256": "fb1222e9e5eb8b7064e319f678b84766e08e9fd7df8faf26f8d9a4bb1529528f" }, "downloads": -1, "filename": "ipython-cache-0.2.1.tar.gz", "has_sig": false, "md5_digest": "84528671773431a7aec9f92f689c2fb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5734, "upload_time": "2018-01-25T16:20:24", "url": "https://files.pythonhosted.org/packages/f0/30/3e66cd6ae907ee6a3618a1a86dd082f5b8b8cb1896d392e12664f5938a3f/ipython-cache-0.2.1.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "3681319b0ff33f4f60e5bdee50831a96", "sha256": "a3b3ceb152c4be887982969cfdea53acdcaa16224ad2173c80a432ad339a612d" }, "downloads": -1, "filename": "ipython-cache-0.2.4.tar.gz", "has_sig": false, "md5_digest": "3681319b0ff33f4f60e5bdee50831a96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6272, "upload_time": "2018-01-25T17:03:18", "url": "https://files.pythonhosted.org/packages/dd/43/7f7b62f899a312273b7b75fb379ec75ba06ea4b56937f0ac9342c450b371/ipython-cache-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "a320425f87a1fb828d905a587820693c", "sha256": "3df613c306eaf7e4a8b7c0c760b7be456680d841b3b4349c513d1be2a5c29d27" }, "downloads": -1, "filename": "ipython-cache-0.2.5.tar.gz", "has_sig": false, "md5_digest": "a320425f87a1fb828d905a587820693c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6297, "upload_time": "2018-01-25T18:02:31", "url": "https://files.pythonhosted.org/packages/1d/7e/d4731dbc732e73916883ef27bc0f65f83fc89c60df6669accddb4d181a4f/ipython-cache-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "2d6d18a325a5a6bc1db6a2ef29119a35", "sha256": "354f58268db34ba5d69154673f368ba4feee2ebfce9ed3d099eb13bae5a369c5" }, "downloads": -1, "filename": "ipython-cache-0.2.6.tar.gz", "has_sig": false, "md5_digest": "2d6d18a325a5a6bc1db6a2ef29119a35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6816, "upload_time": "2018-01-26T11:52:51", "url": "https://files.pythonhosted.org/packages/73/d8/27823c53e27450ce920bb1f22aa9f70838f6a1ccdbcdedc658549b9b585b/ipython-cache-0.2.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2d6d18a325a5a6bc1db6a2ef29119a35", "sha256": "354f58268db34ba5d69154673f368ba4feee2ebfce9ed3d099eb13bae5a369c5" }, "downloads": -1, "filename": "ipython-cache-0.2.6.tar.gz", "has_sig": false, "md5_digest": "2d6d18a325a5a6bc1db6a2ef29119a35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6816, "upload_time": "2018-01-26T11:52:51", "url": "https://files.pythonhosted.org/packages/73/d8/27823c53e27450ce920bb1f22aa9f70838f6a1ccdbcdedc658549b9b585b/ipython-cache-0.2.6.tar.gz" } ] }