{ "info": { "author": "Iv\u00e1n de Paz Centeno", "author_email": "ipazc@unileon.es", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "Natural Language :: English", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "PyMDict\n#######\n\n.. image:: https://badge.fury.io/py/pymdict.svg\n :target: https://badge.fury.io/py/pymdict\n.. image:: https://travis-ci.org/ipazc/pymdict.svg?branch=master\n :target: https://travis-ci.org/ipazc/pymdict\n.. image:: https://coveralls.io/repos/github/ipazc/pymdict/badge.svg?branch=master\n :target: https://coveralls.io/github/ipazc/pymdict?branch=master\n\n\nAdvanced Python Mongo Dict.\nA Python dictionary based on a MongoDB. It allows to treat a collection as a dictionary in Python, with extensive capabilities, like allowing basic queries, bulk operations and versioning (forks).\n\nINSTALLATION\n############\n\nCurrently it is only supported Python3.4 onwards. It can be installed through pip:\n\n.. code:: bash\n\n $ pip3 install pymdict\n\n\nUSAGE\n#####\n\nIn order to run, a MongoDB server is required.\n\nA Mongo-based dictionary can be instantiated as follows:\n\n.. code:: python\n\n >>> from pymdict.mongo_dict import MongoDict\n >>>\n >>> m = MongoDict(\"custom_id\", mongo_host=\"localhost\", mongo_port=27017)\n\n\nOnce `m` is instantiated, it can be used as a normal dictionary.\n\n.. code:: python\n\n >>> m[\"key\"] = \"value\"\n >>> m[44] = \"value2\"\n >>> m[\"key2\"] = \"value3\"\n >>> m[\"number\"] = 44\n\n >>> print(list(m.keys()))\n [\"key\", 44, \"key2, \"number\"]\n\n >>> for key, value in m.items():\n ... print(\"{}: {}\".format(key, value))\n key: value\n 44: value2\n key2: value3\n number: 44\n\n\nIn addition, there are advanced functionalities like queries:\n\n.. code:: python\n\n >>> for key, value, _ in m('key % ey'):\n ... print(\"{}: {}\".format(key, value))\n key: value\n key2: value3\n\n >>> for key, value, _ in m('key % ey or value = 44'):\n ... print(\"{}: {}\".format(key, value))\n key: value\n key2: value3\n number: 44\n\nQueries also support to query with sub-dict elements:\n\n.. code:: python\n\n >>> m[\"first\"] = {\"example\": 44}\n >>> m[\"second\"] = {\"example\": 45}\n >>> m[\"third\"] = {\"example\": 46}\n\n >>> for key, value, _ in m('value.example > 44 and value.example < 46'):\n ... print(\"{}: {}\".format(key, value))\n second: 45\n\n(TODO: Check the wiki page for more information about the query syntax)\n\nNote that all the stores and removals are stored within a MongoDB. This means for each addition,edit and removal there is at least one connection to the MongoDB backend. In order to optimize it, a bulk operation can be used to wrap such amount of operations in a single connection:\n\n.. code:: python\n\n >>> with m.bulk(buffer_size=100) as m:\n ... for x in range(2000):\n ... m[\"key{}\".format(x)] = {\"example\": x}\n\nAlso, a mongo dict can be forked without the need to copy its content. This is specially useful if the target dict is extremely big and a copy is wanted. Note that a fork is an immediate process, and it allows to override or remove elements without modifying an original dictionary. It is achieved by applying a versioning technique with the dictionaries and it is still in an experimental state.\n\n(TODO: More information about forking and versioning in the wiki page)\n\n.. code:: python\n\n >>> m['foo'] = \"bar\"\n >>> fork = m.fork()\n >>> print(fork['foo'])\n bar\n >>> fork['foo'] = \"foo\"\n >>> print(fork['foo'], m['foo'])\n foo bar\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ipazc/pymdict", "keywords": "pymdict mongo dict python query advanced fork pip package", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pymdict", "package_url": "https://pypi.org/project/pymdict/", "platform": "", "project_url": "https://pypi.org/project/pymdict/", "project_urls": { "Homepage": "http://github.com/ipazc/pymdict" }, "release_url": "https://pypi.org/project/pymdict/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Python Mongo-Dict, a dictionary-like class automatically stored in mongo, with query capabilities.", "version": "0.0.4" }, "last_serial": 3800163, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "0cd127de6a0621e3d99fbc94909be74c", "sha256": "8057ffef23c53e537910131f17bd7557439f4cc25d3ef8497059f54605eb8561" }, "downloads": -1, "filename": "pymdict-0.0.1.tar.gz", "has_sig": false, "md5_digest": "0cd127de6a0621e3d99fbc94909be74c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14146, "upload_time": "2018-02-13T11:40:18", "url": "https://files.pythonhosted.org/packages/75/e2/bc22dcf61bbd97c7aebebdcb4c1efe3e2dc7fd9aacc16b3e624b0c8c40b3/pymdict-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "ffa1e1bb9845208cecb7aff306cfea84", "sha256": "a1b436d91a413b464e643b0fcd565fb490ab98e2057833ef0654cba8a3adce2a" }, "downloads": -1, "filename": "pymdict-0.0.2.tar.gz", "has_sig": false, "md5_digest": "ffa1e1bb9845208cecb7aff306cfea84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14154, "upload_time": "2018-02-13T11:43:29", "url": "https://files.pythonhosted.org/packages/64/78/ede8ad649723777ca095ce4c112a605c6a63365adf11d3b2c51f49b05879/pymdict-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "b2e40879cbb263d9c0489521d88db0e9", "sha256": "cbc9bb360a2e8e941d258b984de32079dfc49df549c5c801aa9fc5cd6e22ae90" }, "downloads": -1, "filename": "pymdict-0.0.3.tar.gz", "has_sig": false, "md5_digest": "b2e40879cbb263d9c0489521d88db0e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16345, "upload_time": "2018-02-14T16:59:52", "url": "https://files.pythonhosted.org/packages/51/91/46c58c2851408746120e9f9ff38e3d863232296d9edc1d41fb1de83af038/pymdict-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "17ce155d5a8fbd1dcffd60a8e02eaf3e", "sha256": "f7b5df2bacef92546aa4523516292d6d846e3a0c0206c6f2ede971e02ec6f889" }, "downloads": -1, "filename": "pymdict-0.0.4.tar.gz", "has_sig": false, "md5_digest": "17ce155d5a8fbd1dcffd60a8e02eaf3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15067, "upload_time": "2018-04-23T19:31:39", "url": "https://files.pythonhosted.org/packages/04/19/38d5f8be87fef8c6a7233f2164957669afb39eae2590aabc4c03c2b3bb3b/pymdict-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "17ce155d5a8fbd1dcffd60a8e02eaf3e", "sha256": "f7b5df2bacef92546aa4523516292d6d846e3a0c0206c6f2ede971e02ec6f889" }, "downloads": -1, "filename": "pymdict-0.0.4.tar.gz", "has_sig": false, "md5_digest": "17ce155d5a8fbd1dcffd60a8e02eaf3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15067, "upload_time": "2018-04-23T19:31:39", "url": "https://files.pythonhosted.org/packages/04/19/38d5f8be87fef8c6a7233f2164957669afb39eae2590aabc4c03c2b3bb3b/pymdict-0.0.4.tar.gz" } ] }