{ "info": { "author": "Ziad Sawalha", "author_email": "ziad@sawalha.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Database", "Topic :: Software Development :: Libraries", "Topic :: Utilities" ], "description": "Morpheus |Build Status| |Coverage Status|\n=========================================\n\nMorpheus helps you define schemas for your dict-based classes and\nperform validation, migration, and generate documentation. It tries to\nmake this normally unfun task painless and easy.\n\nDesign Goals\n~~~~~~~~~~~~\n\n**Readable.** Like a docstring at the top of your class definition, a\nschema definition should be readable and understandable.\n\n**Transparent.** You know how to work with dicts. You should be able to\nkeep using dicts. And you should be able to import morpheus or leave it\nout and your code should still work.\n\n**Flexible.** You get to pick which backend you use (sqlalchemy, sqlite,\nNoSQL, etc...), so morpheus operates on native python dicts and doesn't\ntouch your data store.\n\nFeatures\n~~~~~~~~\n\n- Intuitive schema definition using pythonic idioms\n- Optional schema validation and inspection controlled globally or per\n class\n- Automatic or on-demand migration from an older schema to the current\n one\n- Generates schema documentation for developers and users\n- DRY definition of schemas. Do it once. Do it in one place. Use it\n anywhere (docs, data store, and code)\n- Zero dependencies required\n- Enable/disable it with a single line\n- Passes all python tests for a dict (including json and pickle\n serialization)\n- Painless, pain-free, simple and easy!\n\nInstall\n~~~~~~~\n\n.. code:: bash\n\n $ pip install morpheus\n\nUsage\n~~~~~\n\nHere is a simple example of a schema definition on a dict-based class.\n\n.. code:: python\n\n # Let's import MorpheusDict as dict in our module\n from morpheus import MorpheusDict as dict\n # Note: Comment this last line out to completely disable morpheus. No code\n # changes needed.\n\n\n #\n # Let's limit the keys allowed on our dict-based class by adding a __schema__\n # entry\n #\n class Foo(dict):\n __schema__ = ['id', 'name', 'state']\n\n #\n # Now let's make sure this really works\n #\n try:\n Foo(sneaky='git blame someone for this!')\n except AttributeError as exc:\n print \"Thank you, Morpheus! You caught an error: %s\" % exc\n\n # Prints:\n #\n # Thank you, Morpheus! You caught an error: 'sneaky' is not a permitted\n # attribute for a 'Foo'\n #\n\nHere is a more involved example, demonstrating multiple schemas,\nvalidation, and migration.\n\n.. code:: python\n\n\n from morpheus import MorpheusDict, Schema, Defn\n\n class Foo(dict):\n __schema__ = Schema(\n id=Defn(int, required=True),\n statoos=basestring,\n state=as_of(0.7).is_replaced_by('statoos')\n )\n\n print Foo({'id': 1, 'state': 'DEPRECATED'})\n\n # Prints:\n #\n # {'id': 1, 'statoos': 'DEPRECATED'}\n #\n\n Foo({})\n # Generates ValidationError(\"Missing required key 'id'\")\n\nPerformance\n~~~~~~~~~~~\n\nTo test performance, run ``python tests/test_performance.py``\n\nThe current performance is ~14 times slower than native dict.\n\nVersus the following implementations:\n\n- Simple: 1392.72517321% (from 0.0004 to 0.006)\n- Subclass: 1358.45980888% (from 0.0004 to 0.006)\n- Mapping: 439.377796719% (from 0.001 to 0.006)\n- List: 10094.0655908% (from 0.0005 to 0.05)\n- Complex: 7229.4047619% (from 0.0008 to 0.06)\n\nContributing\n~~~~~~~~~~~~\n\nZiad Sawalha (ziadsawalha) is the creator and current maintainer of\nMorpheus. Pull requests are always welcome.\n\nBefore submitting a pull request, please ensure you have added/updated\nthe appropriate tests (and that all existing tests still pass with your\nchanges), and that your coding style follows PEP 8 and doesn't cause\npyflakes to complain.\n\nrst doc generated from markdown with::\n\n::\n\n pandoc --from=markdown --to=rst --output=README.rst README.md\n\nLegal\n~~~~~\n\nCopyright 2013 by Ziad Sawalha.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may\nnot use this file except in compliance with the License. You may obtain\na copy of the License at\n\n::\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n.. |Build Status| image:: https://travis-ci.org/ziadsawalha/morpheus.png\n :target: https://travis-ci.org/ziadsawalha/morpheus\n.. |Coverage Status| image:: https://coveralls.io/repos/ziadsawalha/morpheus/badge.png?branch=master\n :target: https://coveralls.io/r/ziadsawalha/morpheus", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ziadsawalha/morpheus", "keywords": "schema NoSQL validation migration", "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "morpheus", "package_url": "https://pypi.org/project/morpheus/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/morpheus/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/ziadsawalha/morpheus" }, "release_url": "https://pypi.org/project/morpheus/0.0.4/", "requires_dist": null, "requires_python": null, "summary": "Dict schema helper for schema-free projects", "version": "0.0.4" }, "last_serial": 750901, "releases": { "0.0.1": [], "0.0.2": [ { "comment_text": "", "digests": { "md5": "fbd97b43075899e2394566dea80b95d0", "sha256": "504986be05057fcc8f28caa03d633f5084a753cad29bb489b7d622656930ba6c" }, "downloads": -1, "filename": "morpheus-0.0.2.tar.gz", "has_sig": false, "md5_digest": "fbd97b43075899e2394566dea80b95d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4895, "upload_time": "2013-05-06T08:16:43", "url": "https://files.pythonhosted.org/packages/89/36/dd01e0292421194c530ae47c1b88e9a7f1f37843de13a45de74b581c3951/morpheus-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "841175edbb598404d0fe67fc85f9c454", "sha256": "d8f7bd09feb6a9b8c4a6eb14d767cc42399fb32357fa39738d0a46f2aaa44d56" }, "downloads": -1, "filename": "morpheus-0.0.3.tar.gz", "has_sig": false, "md5_digest": "841175edbb598404d0fe67fc85f9c454", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18375, "upload_time": "2013-05-31T05:33:39", "url": "https://files.pythonhosted.org/packages/a0/b9/1329393ddd59fc28d2d37dad5f125d0776f596efaf6c655047040657b429/morpheus-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "348c126487cbad8dec19417657678d89", "sha256": "d6898f3333fb5cc76ce504ee955a56029c09e95e1c6dbd0ea660e9dcbd9a6628" }, "downloads": -1, "filename": "morpheus-0.0.4.tar.gz", "has_sig": false, "md5_digest": "348c126487cbad8dec19417657678d89", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19004, "upload_time": "2013-05-31T05:44:42", "url": "https://files.pythonhosted.org/packages/98/84/3254353979f354fc492fcc81b2a6c8cf6a24e221e99fa14b64c49a4b1c59/morpheus-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "348c126487cbad8dec19417657678d89", "sha256": "d6898f3333fb5cc76ce504ee955a56029c09e95e1c6dbd0ea660e9dcbd9a6628" }, "downloads": -1, "filename": "morpheus-0.0.4.tar.gz", "has_sig": false, "md5_digest": "348c126487cbad8dec19417657678d89", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19004, "upload_time": "2013-05-31T05:44:42", "url": "https://files.pythonhosted.org/packages/98/84/3254353979f354fc492fcc81b2a6c8cf6a24e221e99fa14b64c49a4b1c59/morpheus-0.0.4.tar.gz" } ] }