{ "info": { "author": "Rhet Turnbull", "author_email": "rturnbull+git@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "S3Dictionary [Homepage](https://github.com/RhetTbull/s3dict)\n========\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\nWhat is S3Dictionary?\n-----------------\n\nImplements a persistent python dictionary class (inherited from collections.UserDict) that serializes its state as a json file in an Amazon AWS S3 bucket. This works well for simple persistence if all you need is to save some key/value pairs. \n\nS3Dictionary should be a drop-in replacement for a standard python dict.\n\nIf you think you need this module, you probably need something else. S3Dictionary is simple and easy to use though if all you need is a persitent dictionary. With lazy saving (autosave=False), it's also reasonably fast.\n\n\nInstallation instructions\n-------------------------\n\n\tpython setup.py install\n\n\nExample uses of the module\n--------------------------\n\n```python\nfrom s3dictionary import S3Dict\n\nif __name__ == \"__main__\":\n\n \"\"\" create an instance of S3Dict \"\"\"\n state = S3Dict(\n bucket_name=AWS_BUCKET_NAME,\n access_key_id=AWS_ACCESS_KEY_ID,\n access_secret_key=AWS_ACCESS_SECRET_KEY,\n file_name=\"test.json\",\n )\n\n \"\"\" assignment like any python dictionary \"\"\"\n state[\"foo\"] = \"bar\"\n\n \"\"\" save back to S3 bucket \"\"\"\n state.save()\n\n```\n\nSee example.py for additional usage examples.\n\nModule Interface\n----------------\n```python\nS3Dict(bucket_name=AWS_BUCKET_NAME,\n access_key_id=AWS_ACCESS_KEY_ID,\n access_secret_key=AWS_ACCESS_SECRET_KEY,\n file_name=\"filename.json\",\n [autosave=False],\n [data=None]),\n [default=None],\n```\n\nConstruct a new S3Dict object. If `file_name` exists, restores state from file. If file_name does not exist, initialize a new dictionary. In the case the file does not already exist, it will not be created in the S3 bucket until you call `save()` unless `autosave=True`. \n\nIf a dictionary is passed in `data` the dictionary will be initialized with what was passed in `data`. This will overwrite any data that was loaded from file. If a dictionary is passed in `default` and the file does not exist, the dictionary will be initialized with what was passed in `default`. Unlike the `data` argument, `default` will not overwrite any existing data.\n\n*Required arguments*\n - `bucket_name`: name of S3 bucket\n - `acess_key_id`: AWS access key id\n - `access_secret_key`: AWS secret key\n - `file_name`: file name of the serialized dictionary to be stored in S3 bucket\n\n*Optional arguments*\n - `autosave`: must be `bool`, default is False -- setting this to True causes every update to the underlying dictionary to be immediately serialized to S3\n - `data`: python dictionary used to initialize data\n - `default`: python dictionary used to initialize data if the file does not already exist in the S3 bucket\n\n```python\nS3Dict.save()\n```\n\nForce state to be serialized to S3 bucket\n\n```python\nS3Dict.load()\n```\n\nForce state to be immediately loaded from S3 bucket. In normal circumstances, you won't need to do this. It might be useful if an external processes updates the state information and you want to force a reload. \n\n```python\nS3Dict.autosave = True|False\nS3Dict.autosave\n```\n\nTurn autosave on (True) or off (False). Also a property to read autosave value. If `autosave` is `True`, every update to the dictionary will immediately be serialized back to the S3 bucket. Please be sure you understand what this means before turning `autosave` on!\n\n```python\nS3Dict.file_name\nS3Dict.access_key_id\nS3Dict.access_secret_key\nS3Dict.bucket_name\n```\n\nRead only properties\n\n```python\nS3Dict.delete()\n```\n\nClear the stored data and deletes the json file from S3. The user must have S3 DeleteObject permissions. This does not delete the actual S3Dict object instance. To do that, follow call S3Dict.delete() with del. \n\n```python\nfrom s3dictionary import S3Dict\n\nmys3dict = S3Dict(...)\n...\nmys3dict.delete() # deletes the data and the file\ndel mys3dict # deletes the object\n```\n\nUsage Notes\n-----------\n\nTo use S3Dict, you must first create an Amazon S3 bucket and a user with permissions to access the bucket.\n\nI highly recommend [Keith Weaver's](https://github.com/keithweaver) excellent [tutorial](https://github.com/keithweaver/python-aws-s3) on using AWS S3 with python and setting up buckets and users.\n\nBe careful with ```autosave``` as it could cost you money--if your underlying dict changes a lot, autosave will cause S3Dict to pound your S3 account with frequent PUT commands which could result in charges. It is also costly in terms of execution speed as every change to the underlying dictionary forces an interaction with the S3 server.\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/RhetTbull/s3dict", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/RhetTbull/", "keywords": "", "license": "License :: OSI Approved :: MIT License", "maintainer": "", "maintainer_email": "", "name": "S3Dictionary", "package_url": "https://pypi.org/project/S3Dictionary/", "platform": "", "project_url": "https://pypi.org/project/S3Dictionary/", "project_urls": { "Download": "https://github.com/RhetTbull/s3dict", "GitHub": "https://github.com/RhetTbull/s3dict", "Homepage": "https://github.com/RhetTbull/" }, "release_url": "https://pypi.org/project/S3Dictionary/0.13/", "requires_dist": [ "boto3" ], "requires_python": "", "summary": "python dictionary class providing persistent storage by serializing state to a json file on an Amazon S3 bucket", "version": "0.13" }, "last_serial": 5531414, "releases": { "0.10": [ { "comment_text": "", "digests": { "md5": "649799be1167c71a65dff2949e1dec52", "sha256": "7b15a4633318c8c92099259f231bb7f3b8e149229a29d9edc5dec0924dbd8bfc" }, "downloads": -1, "filename": "S3Dictionary-0.10-py3-none-any.whl", "has_sig": false, "md5_digest": "649799be1167c71a65dff2949e1dec52", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6939, "upload_time": "2019-07-14T14:49:45", "url": "https://files.pythonhosted.org/packages/b6/fd/6a8029d7e78b5073b33c021b60ea0deccf4f5d8a9845653ffa5ff1677610/S3Dictionary-0.10-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8569b0879dded6b06dcc4717408c92ce", "sha256": "34a07703f777fbecb261d53dd9db94c6d4929ba8962e3432f04f7cadbde6346a" }, "downloads": -1, "filename": "S3Dictionary-0.10.tar.gz", "has_sig": false, "md5_digest": "8569b0879dded6b06dcc4717408c92ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4776, "upload_time": "2019-07-14T14:49:48", "url": "https://files.pythonhosted.org/packages/be/bf/6249b2d396a0c7c67a36577d2457953e7f3ec772f98d5b18f1d0b5dbbea1/S3Dictionary-0.10.tar.gz" } ], "0.11": [ { "comment_text": "", "digests": { "md5": "8ba74fdb3e44706b43771757bbf9681c", "sha256": "1fd76b200d5ec682d924868e480b261e62244bcc7414d6da94a19b3f692b6185" }, "downloads": -1, "filename": "S3Dictionary-0.11-py3-none-any.whl", "has_sig": false, "md5_digest": "8ba74fdb3e44706b43771757bbf9681c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6944, "upload_time": "2019-07-14T15:21:53", "url": "https://files.pythonhosted.org/packages/18/b7/89369357b42b4c09fb63148da7057b751e1255010aeda036d03f8d63b69d/S3Dictionary-0.11-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6268e0ba60fba880fd7fc84ed841d14d", "sha256": "53292c0d084d4cf3cbc4af7762f38fe3d22ba45fe526110ab514f487bf46129a" }, "downloads": -1, "filename": "S3Dictionary-0.11.tar.gz", "has_sig": false, "md5_digest": "6268e0ba60fba880fd7fc84ed841d14d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4753, "upload_time": "2019-07-14T15:21:54", "url": "https://files.pythonhosted.org/packages/ee/2c/f420ab28633dfecfe89f38ff34128de63d939386e6c6d871fbdb7768b20b/S3Dictionary-0.11.tar.gz" } ], "0.12": [ { "comment_text": "", "digests": { "md5": "362224def0657822918a22c5662e26cd", "sha256": "5f9b6858bd865b54e2d76132dbc0734b729e91e62390059dd4ccaf49d80255c2" }, "downloads": -1, "filename": "S3Dictionary-0.12-py3-none-any.whl", "has_sig": false, "md5_digest": "362224def0657822918a22c5662e26cd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7069, "upload_time": "2019-07-14T15:45:24", "url": "https://files.pythonhosted.org/packages/af/51/978ea9baf66e7cdfe2dc979549293ab058f3f44f0c6c4d9149d76127a4e9/S3Dictionary-0.12-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8498519eed99597931934f870f886190", "sha256": "b35174b1e29ee0b899267686ca49515b28527f0980ca1ea83c39245da68bf1f5" }, "downloads": -1, "filename": "S3Dictionary-0.12.tar.gz", "has_sig": false, "md5_digest": "8498519eed99597931934f870f886190", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4906, "upload_time": "2019-07-14T15:45:26", "url": "https://files.pythonhosted.org/packages/33/00/c900d1d2511af87a3cfe04a64f9997b48ef1932ae20ed97d84dd385a319b/S3Dictionary-0.12.tar.gz" } ], "0.13": [ { "comment_text": "", "digests": { "md5": "4aca5199ea244238f0731219c6017f66", "sha256": "2951b90c2a34c31f7d58bcfeea97c399e8b7929e560c069380fc859e6fac4e65" }, "downloads": -1, "filename": "S3Dictionary-0.13-py3-none-any.whl", "has_sig": false, "md5_digest": "4aca5199ea244238f0731219c6017f66", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7029, "upload_time": "2019-07-14T16:06:50", "url": "https://files.pythonhosted.org/packages/dc/cc/4dba74716245162bf1cb0278c606374e7cca78a34504ec4d26e20ce97616/S3Dictionary-0.13-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a67a4b4ec47229607133e99b62e6790", "sha256": "2d5c17fa39faabb0e6668032b6a7509b29289966506bdbf821a18e9235d16654" }, "downloads": -1, "filename": "S3Dictionary-0.13.tar.gz", "has_sig": false, "md5_digest": "4a67a4b4ec47229607133e99b62e6790", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4866, "upload_time": "2019-07-14T16:06:51", "url": "https://files.pythonhosted.org/packages/b7/f0/70835e1f5f1cf93ff4217ecf2b66936968d8d3bd00d3fbb1a8ea4b8071e6/S3Dictionary-0.13.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4aca5199ea244238f0731219c6017f66", "sha256": "2951b90c2a34c31f7d58bcfeea97c399e8b7929e560c069380fc859e6fac4e65" }, "downloads": -1, "filename": "S3Dictionary-0.13-py3-none-any.whl", "has_sig": false, "md5_digest": "4aca5199ea244238f0731219c6017f66", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7029, "upload_time": "2019-07-14T16:06:50", "url": "https://files.pythonhosted.org/packages/dc/cc/4dba74716245162bf1cb0278c606374e7cca78a34504ec4d26e20ce97616/S3Dictionary-0.13-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a67a4b4ec47229607133e99b62e6790", "sha256": "2d5c17fa39faabb0e6668032b6a7509b29289966506bdbf821a18e9235d16654" }, "downloads": -1, "filename": "S3Dictionary-0.13.tar.gz", "has_sig": false, "md5_digest": "4a67a4b4ec47229607133e99b62e6790", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4866, "upload_time": "2019-07-14T16:06:51", "url": "https://files.pythonhosted.org/packages/b7/f0/70835e1f5f1cf93ff4217ecf2b66936968d8d3bd00d3fbb1a8ea4b8071e6/S3Dictionary-0.13.tar.gz" } ] }