{ "info": { "author": "Asmodius", "author_email": "asmodius.a@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Application Frameworks" ], "description": "# mokito\nAn asynchronous ORM for accessing MongoDB in Tornado\n\n## What is mokito?\n(MOngodb + [mongoKIt](https://github.com/namlook/mongokit) + TOrnado) is an asynchronous toolkit for working with ``mongodb`` inside a ``tornado`` app, like ``mongokit``. Mokito has a pure implementation of python + tornado and only depends on tornado and bson (provided by pymongo)\n\n## Why not pymongo?\n[PyMongo](http://api.mongodb.org/python/current/) is the recommended way to work with MongoDB in Python, but isn't asynchronous and not run inside tornado's IOLoop. If you use pymongo you won't take the advantages of tornado.\n\n## Why not motor?\n[Motor](http://emptysquare.net/motor/) wraps PyMongo and makes it async with greenlet. This is a great project, but it uses greenlet. If you can use greenlets why not use gevent instead of tornado? PyMongo already works with gevent. If you are using a very powerfull non-blocking web server with a pure python code, you'll probably want to work with a pure tornado driver for accessing mongo.\n\n## Features\n* validation and conversion of data to the specified type\n* support for unstructured data\n* dot notation\n* control over data presentation\n* control over data validation\n* mapping onto the same document of models with different schemes\n\n## Installing\n```bash\npip install pymomgo tornado\npip install mokito\n```\n\n## Simple usage\n```python\nfrom tornado.web import RequestHandler\nfrom tornado.gen import coroutine\n\nimport mokito\n\n\nclass MainHandler(RequestHandler):\n\n def initialize(self):\n self.db = mokito.Client(\"db_name\", \"mongodb://127.0.0.1:27017\")\n\n @gen.coroutine\n def get(self, user_id):\n user = yield self.db.user.find_one(user_id)\n self.render(\"index.html\", user=user)\n```\n\n## Using ORM\nA Document declaration look as follows:\n\n```python\nfrom mokito import Document\n\nclass BlogPost(Document):\n fields = {\n 'title':str,\n 'body':str,\n 'author':str\n }\n\nblogpost = BlogPost(title='my title', body='a body', author='unknown', foo='bar')\nblogpost['author'] = 'me'\nyield blogpost.save()\n```\nMongoDB in the collection \"blog_post\" will write this document:\n```javascript\n{\"_id\": ObjectId(\"...\"), \"body\": \"a body\", \"author\": \"me\", \"title\": \"my title\"}\n```\nThe field \"foo\" will not be saved. More about this you can read in [wiki](https://github.com/asmodius/mokito/wiki).\n\nAnd you can use a more complex structure as follows:\n```python\nclass ComplexDoc(Document):\n __uri__ = \"mongodb://127.0.0.1:27017\"\n __database__ = 'test'\n __collection__ = 'example'\n\n fields = {\n \"f_1\": None,\n \"f_2\": int,\n \"f_3\": float,\n \"f_4\": dict,\n \"f_5\": [str],\n \"f_6\": (int, str),\n \"f_7\": {\n \"x_1\": {'a': int, 'b': datetime.datetime},\n \"x_2\": None,\n \"x_3\": list\n }\n }\n```\n\nPlease see the [wiki](https://github.com/asmodius/mokito/wiki) for more examples.\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/Asmodius/mokito/archive/master.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Asmodius/mokito", "keywords": "mongo mongodb tornado mokito", "license": "New BSD License", "maintainer": "", "maintainer_email": "", "name": "mokito", "package_url": "https://pypi.org/project/mokito/", "platform": "", "project_url": "https://pypi.org/project/mokito/", "project_urls": { "Download": "https://github.com/Asmodius/mokito/archive/master.zip", "Homepage": "https://github.com/Asmodius/mokito" }, "release_url": "https://pypi.org/project/mokito/0.3.9/", "requires_dist": null, "requires_python": "", "summary": "Mokito is an asynchronous ORM for working with MongoDB inside a Tornado app", "version": "0.3.9" }, "last_serial": 3223809, "releases": { "0.1.18": [ { "comment_text": "", "digests": { "md5": "2645312de67effde82464553441ed241", "sha256": "c2547f286862712c8114fc97d7d27cc3bfc6895e90742422a918e5d530cbf3d0" }, "downloads": -1, "filename": "mokito-0.1.18.tar.gz", "has_sig": false, "md5_digest": "2645312de67effde82464553441ed241", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26567, "upload_time": "2016-12-05T14:51:28", "url": "https://files.pythonhosted.org/packages/22/cf/b538e1323a3ab76a8d20b414bb27943573b2c8be0676a985de6c79b44a0b/mokito-0.1.18.tar.gz" } ], "0.2.15": [ { "comment_text": "", "digests": { "md5": "ce6011f16a5764c72648f1262c38db97", "sha256": "107b1601eee443a5f4d2f011b47d45f495fe3b400308dc17eefe25c5bea54dc3" }, "downloads": -1, "filename": "mokito-0.2.15.tar.gz", "has_sig": false, "md5_digest": "ce6011f16a5764c72648f1262c38db97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30900, "upload_time": "2017-03-27T09:41:23", "url": "https://files.pythonhosted.org/packages/62/c9/3b18e9eb9dc6cd9effb73cdc2035c82e0f531668a0cac6865ea78bf829b5/mokito-0.2.15.tar.gz" } ], "0.3.6": [ { "comment_text": "", "digests": { "md5": "02b568dbfcad181ead4c35c0a66fc6d2", "sha256": "42923397e0d1d1cd0725bdf45e1ba796012b3d51765b230e2cdea6583e552602" }, "downloads": -1, "filename": "mokito-0.3.6.tar.gz", "has_sig": false, "md5_digest": "02b568dbfcad181ead4c35c0a66fc6d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24865, "upload_time": "2017-09-06T03:21:20", "url": "https://files.pythonhosted.org/packages/74/d2/c110793ca33bfd725ce5a79bb17a1ffe83010b16af1966ddc9149d572461/mokito-0.3.6.tar.gz" } ], "0.3.7": [ { "comment_text": "", "digests": { "md5": "18c4f49773c19ff365d3e2980c4689bb", "sha256": "b2fc2642057deb5a1a9ef4dc6dc91acd4a043dcaf04d8b82e822675056587644" }, "downloads": -1, "filename": "mokito-0.3.7.tar.gz", "has_sig": false, "md5_digest": "18c4f49773c19ff365d3e2980c4689bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24848, "upload_time": "2017-09-06T03:28:31", "url": "https://files.pythonhosted.org/packages/00/f0/a1586f467bb7240ca56aeb5d554e7b3a27a91629a6334fc59fb246a2d906/mokito-0.3.7.tar.gz" } ], "0.3.8": [ { "comment_text": "", "digests": { "md5": "b90cb5eff68c7aad387c3bbad9702aa6", "sha256": "5d260098b0fb0519b8a7472ef7a64e32304317e874f61e8ca1e220f7f6d815e0" }, "downloads": -1, "filename": "mokito-0.3.8.tar.gz", "has_sig": false, "md5_digest": "b90cb5eff68c7aad387c3bbad9702aa6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24714, "upload_time": "2017-09-19T22:30:55", "url": "https://files.pythonhosted.org/packages/6d/92/5262b63269583ba9590a577add4f33cc81cdd1f6f3c4695b44664025a0af/mokito-0.3.8.tar.gz" } ], "0.3.9": [ { "comment_text": "", "digests": { "md5": "2073a8b6f0d3ee74cf64c06948b4cebc", "sha256": "140df0268fee212665aa8a109b03330c6cf77b5a2fac148c8ad841f0f1548cb0" }, "downloads": -1, "filename": "mokito-0.3.9.tar.gz", "has_sig": false, "md5_digest": "2073a8b6f0d3ee74cf64c06948b4cebc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24821, "upload_time": "2017-10-04T02:27:14", "url": "https://files.pythonhosted.org/packages/e5/35/156fc0dbd8fd5ad8d4e6b1364c56b3c800c4d8ed9c2626896341855d2d41/mokito-0.3.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2073a8b6f0d3ee74cf64c06948b4cebc", "sha256": "140df0268fee212665aa8a109b03330c6cf77b5a2fac148c8ad841f0f1548cb0" }, "downloads": -1, "filename": "mokito-0.3.9.tar.gz", "has_sig": false, "md5_digest": "2073a8b6f0d3ee74cf64c06948b4cebc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24821, "upload_time": "2017-10-04T02:27:14", "url": "https://files.pythonhosted.org/packages/e5/35/156fc0dbd8fd5ad8d4e6b1364c56b3c800c4d8ed9c2626896341855d2d41/mokito-0.3.9.tar.gz" } ] }