{ "info": { "author": "Adri\u00e1n P\u00e9rez de Castro", "author_email": "adrian@perezdecastro.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.4" ], "description": "===================================================\n Lightweight Annotated Schema Serializable Objects\n===================================================\n\n.. image:: https://readthedocs.org/projects/gnarl/badge/?version=latest\n :target: https://gnarl.readthedocs.io/en/latest\n :alt: Documentation Status\n\n.. image:: https://img.shields.io/travis/aperezdc/gnarl.svg?style=flat\n :target: https://travis-ci.org/aperezdc/gnarl\n :alt: Build Status\n\n.. image:: https://img.shields.io/coveralls/aperezdc/gnarl/master.svg?style=flat\n :target: https://coveralls.io/r/aperezdc/gnarl?branch=master\n :alt: Code Coverage\n\n.. |knot-icon| image:: https://github.com/aperezdc/gnarl/raw/master/doc/knot.png\n\nGnarl |knot-icon| is a small module for `Python `_ which\nallows defining classes with type-checked attributes, conforming to a\npredetermined schema.\n\nClasses with Gnarl |knot-icon| schemas can be used to:\n\n* **Type-check** object attributes.\n* **Validate** input data.\n* **Deserialize** input data to application objects, with direct support for\n deserializing `JSON `_.\n* **Serialize** application objects to JSON_.\n\n\nUsage\n=====\n\nDefine a class, with a schema attached to it used to type-check the\nattributes:\n\n >>> from gnarl import Schemed\n >>> class Point(Schemed):\n ... __schema__ = { \"x\": int, \"y\": int }\n ...\n >>>\n\nNow values can be created, using keyword arguments to set the values of the\nattributes. Note how the attributes can be accessed normally:\n\n >>> location = Point(x=-3, y=5)\n >>> location.x, location.y\n (-3, 5)\n >>>\n\nAttributes are type-checked:\n\n >>> location.x = 6 # Succeds\n >>> location.x = \"invalid value\" # Fails\n Traceback (most recent call last):\n ...\n gnarl.SchemaError: 'invalid value' should be instance of \n >>> location.x, location.y # Values remain unchanged\n (6, 5)\n >>>\n\nLast, but not least, conversion to and from JSON is automatically supported:\n\n >>> json_text = location.to_json(sort_keys=True)\n >>> json_text\n '{\"x\": 6, \"y\": 5}'\n >>> value = Point.from_json(json_text)\n >>> value.__class__.__name__\n 'Point'\n >>>\n\n\nInstallation\n============\n\nThe stable releases are uploaded to `PyPI `_, so you\ncan install them and upgrade using ``pip``::\n\n pip install gnarl\n\nAlternatively, you can install development versions \u2014at your own risk\u2014\ndirectly from the Git repository::\n\n pip install -e git://github.com/aperezdc/gnarl\n\n\nDocumentation\n=============\n\nThe documentation for Gnarl |knot-icon| is available at:\n\n http://gnarl.readthedocs.io/en/latest\n\nNote that the documentation is work in progress. In the meanwhile, you may\nwant to read the source code of the module itself for additional insight,\nor even better, the code of `projects using the module`__.\n\n__ users_\n\n\nDevelopment\n===========\n\nIf you want to contribute, please use the usual GitHub workflow:\n\n1. Clone the repository.\n2. Hack on your clone.\n3. Send a pull request for review.\n\nIf you do not have programming skills, you can still contribute by `reporting\nissues `_ that you may\nencounter.\n\n\nUsers\n=====\n\nThe following projects make use of Gnarl |gnarl-icon|:\n\n* `intheam-python `__\n* `pebbletime-python `__\n\n(If you use it, please do not hesitate in editing this file and add a line to\nthis list.)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/aperezdc/gnarl", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "gnarl", "package_url": "https://pypi.org/project/gnarl/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/gnarl/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/aperezdc/gnarl" }, "release_url": "https://pypi.org/project/gnarl/0.1.0a4/", "requires_dist": null, "requires_python": null, "summary": "Lightweight module to define serializable, schema-validated classes", "version": "0.1.0a4" }, "last_serial": 2102651, "releases": { "0.1.0a4": [ { "comment_text": "", "digests": { "md5": "4f9394e566fcef395e156b081a091761", "sha256": "c7652c1ad9bbdab3918ff596b6634470499f64e2cd22b37d7ccf42adeac29288" }, "downloads": -1, "filename": "gnarl-0.1.0a4.tar.gz", "has_sig": false, "md5_digest": "4f9394e566fcef395e156b081a091761", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22691, "upload_time": "2016-05-06T13:51:48", "url": "https://files.pythonhosted.org/packages/c8/ae/1a7edcb3aa6929f4771c297fb2bf336d6caca96e422986b20ba122638d7b/gnarl-0.1.0a4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4f9394e566fcef395e156b081a091761", "sha256": "c7652c1ad9bbdab3918ff596b6634470499f64e2cd22b37d7ccf42adeac29288" }, "downloads": -1, "filename": "gnarl-0.1.0a4.tar.gz", "has_sig": false, "md5_digest": "4f9394e566fcef395e156b081a091761", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22691, "upload_time": "2016-05-06T13:51:48", "url": "https://files.pythonhosted.org/packages/c8/ae/1a7edcb3aa6929f4771c297fb2bf336d6caca96e422986b20ba122638d7b/gnarl-0.1.0a4.tar.gz" } ] }