{ "info": { "author": "Rhys Salkind", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3" ], "description": "# Py Filestore\n\nThis is a simple package meant to create a static data structure similar to a dictionary that exists as a group of files.\n\n**If you have used any previous versions prior to 1.1.0, you should update as the last few updates changed how items were saved in the index and how things got hashed.**\n\n#### Example usage\nFirst, download it using pip:\n\n pip install py-filestore\n\nThen:\n```python\nfrom filestore import Filestore\nimport requests\n\n# You can pass your preferred encoding in:\n# store = Filestore(encoding='ascii') # It defaults to utf-8\n# You can also force overwriting on population with\n# store = Filestore(overwrite=True)\nstore = Filestore()\n\n# You can treat this just like a python dictionary!\n# You can populate it in two ways:\nstore['a'] = (1,2,3) \nstore.append(('b', \"The alphabet is pretty cool\"))\nstore[1] = [13.23, 321.0]\n# You can store any data that is supported by python's own\n# pickle package. \nstore['res'] = requests.get(\"https://api.github.com/\")\n# And if you have data that is not supported, you can write\n# and set your own serializer and deserializer for it.\n\nprint(store)\n# {'a': '(1, 2, 3)', 'b': 'The alphabet is pretty cool', 'res': '', 1: [13.23, 321.0]}\n\n# You can get items out too!\nalpha = store['a']\nprint(alpha)\n# (1, 2, 3)\nprint(alpha[1])\n# 2\n\n# The dictionary is saved to file under the directory ./.store\n# which means you can close the session and return for it later\n# as long as the working directory is the same when the class is initialized.\n# However, this leaves residue on the file system. We can clean that up too!\nstore.clean_up() # All the saved data is gone now.\n```\n\n\n\n#### How it works:\nCreating an instance of the class will create a directory on the system that will hold all the given information. An index file is created to allow repopulation over different sessions. \n\nWhen data is added to the *filestore*, the class hashes the key with a naive, non-cryptographic hashing algorithm called [FNV-1a](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash) in 32 bits. This hash becomes the name of the file. Collisions are now handled in the case that they occur!\n\n The actual data gets serialized with python's [pickle](https://docs.python.org/3/library/pickle.html) and then encoded into base64 before being written to the disk. If your data is not compatible with [pickle](https://docs.python.org/3/library/pickle.html), you can write and assign your own serializer/deserializer using `store.set_serializer(my_serializer_function)` and `store.set_deserializer(my_deserializer_function)` prior to inserting or removing data.\n\n #### Tests\n Currently, the testing.py file is not comprehensive and tests random strings of a specific length for collisions. It could use some work, but it does prove that [FNV-1a](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash) has collisions if you look hard enough. \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/Caddox/pyfilestore", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "py-filestore", "package_url": "https://pypi.org/project/py-filestore/", "platform": "", "project_url": "https://pypi.org/project/py-filestore/", "project_urls": { "Homepage": "https://github.com/Caddox/pyfilestore" }, "release_url": "https://pypi.org/project/py-filestore/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "A python package that implements a static dictionary as a file system.", "version": "1.1.0" }, "last_serial": 5498734, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "da0f382f93682e6e807cbd7c2e26a382", "sha256": "ed4b5a631e66bad673e469303e5d900e5328e15d3381f6de39725ef5f2bdfc85" }, "downloads": -1, "filename": "py_filestore-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "da0f382f93682e6e807cbd7c2e26a382", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6980, "upload_time": "2019-06-26T03:14:55", "url": "https://files.pythonhosted.org/packages/54/ad/a3ebe7a22ba32b97fa32492a5f911eeec07add7f9c43a90fdb0215079cef/py_filestore-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "73ca996879c1cbbf935a78c3cc8b0bac", "sha256": "c90edb9342d45f967669daef8527636709081370cd537d33fe0b8bf0499b1161" }, "downloads": -1, "filename": "py-filestore-1.0.0.tar.gz", "has_sig": false, "md5_digest": "73ca996879c1cbbf935a78c3cc8b0bac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5612, "upload_time": "2019-06-26T03:14:59", "url": "https://files.pythonhosted.org/packages/f5/3e/c2fc57be84b84607e6063e4728213cc67709c21e6a3194869e7ffef9872c/py-filestore-1.0.0.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "534534f64e83bc3d947a4ba78439e158", "sha256": "6e43788036ea538417258fcaa9ec314f3a307d5958a34fe0d498c51b07f273a3" }, "downloads": -1, "filename": "py_filestore-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "534534f64e83bc3d947a4ba78439e158", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7360, "upload_time": "2019-07-01T23:54:23", "url": "https://files.pythonhosted.org/packages/37/e4/9bf28f3726fd32ed889fc9a64dad1ea6d531b34010435959e5ba35971b20/py_filestore-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "872f94c6d74fadc574076f5eb1573864", "sha256": "f44883cae41fe012b1bdf5f026e8bae49ce7b6f0dfd3f5af6208393cf0892bb1" }, "downloads": -1, "filename": "py-filestore-1.0.2.tar.gz", "has_sig": false, "md5_digest": "872f94c6d74fadc574076f5eb1573864", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6000, "upload_time": "2019-07-01T23:54:25", "url": "https://files.pythonhosted.org/packages/81/86/35ee1b0c1a19fe18ab35e3f9bb56dfdf3e72dc12bebde484bd916bb731e3/py-filestore-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "fe016ba84d966bb5364226dfb8d0c8fd", "sha256": "7b1d7219c253c7f69d81792aff2bbeaf1ac4667eef07ae91ad77363b387f109a" }, "downloads": -1, "filename": "py_filestore-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "fe016ba84d966bb5364226dfb8d0c8fd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8040, "upload_time": "2019-07-04T02:56:21", "url": "https://files.pythonhosted.org/packages/3e/30/30e37dc64b7dd825a37ad0bbb07438c2171a9519a88dbc576e85f43df2e2/py_filestore-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "58e56bdb8168f4aca90eb65c47e7d135", "sha256": "7d02ec1cc0a40596b86a014f0f86511e6e2249c657578940e67cdd4629fd6b13" }, "downloads": -1, "filename": "py-filestore-1.0.3.tar.gz", "has_sig": false, "md5_digest": "58e56bdb8168f4aca90eb65c47e7d135", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6709, "upload_time": "2019-07-04T02:56:22", "url": "https://files.pythonhosted.org/packages/88/2f/b88b1f091b7fb5f9fa6a7d23d1b2dae06f33aedba795bcb032d434f0bbfa/py-filestore-1.0.3.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "a12973e2412ae224c2de135c73189d51", "sha256": "0247f022bda5043b2bc4f0099de3da305340ac203a994a9b253f7ca505f33be5" }, "downloads": -1, "filename": "py_filestore-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a12973e2412ae224c2de135c73189d51", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8710, "upload_time": "2019-07-08T02:50:29", "url": "https://files.pythonhosted.org/packages/01/f4/b1467225e2a4aeaa87f34a698b8e1d907fd18e6bfb3f1352f8f5b4b72b30/py_filestore-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "680bf4399b1806320e735a67a5484344", "sha256": "503b95b40246a28d92f7bb6c2c1f487558571e1b36d3b8d8bce728c3b374d9f0" }, "downloads": -1, "filename": "py-filestore-1.1.0.tar.gz", "has_sig": false, "md5_digest": "680bf4399b1806320e735a67a5484344", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7361, "upload_time": "2019-07-08T02:50:31", "url": "https://files.pythonhosted.org/packages/62/8b/fef18ced37d2efedb172c12139476f3bedbde9973740caf059c22e58ebf0/py-filestore-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a12973e2412ae224c2de135c73189d51", "sha256": "0247f022bda5043b2bc4f0099de3da305340ac203a994a9b253f7ca505f33be5" }, "downloads": -1, "filename": "py_filestore-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a12973e2412ae224c2de135c73189d51", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8710, "upload_time": "2019-07-08T02:50:29", "url": "https://files.pythonhosted.org/packages/01/f4/b1467225e2a4aeaa87f34a698b8e1d907fd18e6bfb3f1352f8f5b4b72b30/py_filestore-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "680bf4399b1806320e735a67a5484344", "sha256": "503b95b40246a28d92f7bb6c2c1f487558571e1b36d3b8d8bce728c3b374d9f0" }, "downloads": -1, "filename": "py-filestore-1.1.0.tar.gz", "has_sig": false, "md5_digest": "680bf4399b1806320e735a67a5484344", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7361, "upload_time": "2019-07-08T02:50:31", "url": "https://files.pythonhosted.org/packages/62/8b/fef18ced37d2efedb172c12139476f3bedbde9973740caf059c22e58ebf0/py-filestore-1.1.0.tar.gz" } ] }