{"id":13770137,"url":"https://github.com/aperezdc/gnarl","last_synced_at":"2025-06-14T13:04:03.979Z","repository":{"id":34283481,"uuid":"38172164","full_name":"aperezdc/gnarl","owner":"aperezdc","description":"Lightweight module to define serializable, schema-validated classes","archived":false,"fork":false,"pushed_at":"2025-01-15T10:32:38.000Z","size":53,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-21T10:39:54.808Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aperezdc.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-27T19:18:23.000Z","updated_at":"2025-01-15T10:32:39.000Z","dependencies_parsed_at":"2024-04-23T22:35:41.813Z","dependency_job_id":"4ea16b7e-8ca4-49f5-962b-9ccbc8057bfd","html_url":"https://github.com/aperezdc/gnarl","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"e745324a34bacfdbc9b05fd848e1d91e17adcfb2"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/aperezdc/gnarl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aperezdc%2Fgnarl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aperezdc%2Fgnarl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aperezdc%2Fgnarl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aperezdc%2Fgnarl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aperezdc","download_url":"https://codeload.github.com/aperezdc/gnarl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aperezdc%2Fgnarl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259820785,"owners_count":22916545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:00:34.645Z","updated_at":"2025-06-14T13:04:03.947Z","avatar_url":"https://github.com/aperezdc.png","language":"Python","funding_links":[],"categories":["Model, Schema"],"sub_categories":[],"readme":"===================================================\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 \u003chttp://python.org\u003e`_ 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 \u003chttp://json.org\u003e`_.\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   \u003e\u003e\u003e from gnarl import Schemed\n   \u003e\u003e\u003e class Point(Schemed):\n   ...   __schema__ = { \"x\": int, \"y\": int }\n   ...\n   \u003e\u003e\u003e\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   \u003e\u003e\u003e location = Point(x=-3, y=5)\n   \u003e\u003e\u003e location.x, location.y\n   (-3, 5)\n   \u003e\u003e\u003e\n\nAttributes are type-checked:\n\n   \u003e\u003e\u003e location.x = 6  # Succeds\n   \u003e\u003e\u003e location.x = \"invalid value\"  # Fails\n   Traceback (most recent call last):\n      ...\n   gnarl.SchemaError: 'invalid value' should be instance of \u003cclass 'int'\u003e\n   \u003e\u003e\u003e location.x, location.y  # Values remain unchanged\n   (6, 5)\n   \u003e\u003e\u003e\n\nLast, but not least, conversion to and from JSON is automatically supported:\n\n   \u003e\u003e\u003e json_text = location.to_json(sort_keys=True)\n   \u003e\u003e\u003e json_text\n   '{\"x\": 6, \"y\": 5}'\n   \u003e\u003e\u003e value = Point.from_json(json_text)\n   \u003e\u003e\u003e value.__class__.__name__\n   'Point'\n   \u003e\u003e\u003e\n\n\nInstallation\n============\n\nThe stable releases are uploaded to `PyPI \u003chttps://pypi.python.org\u003e`_, so you\ncan install them and upgrade using ``pip``::\n\n   pip install gnarl\n\nAlternatively, you can install development versions —at your own risk—\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 \u003chttps://github.com/aperezdc/gnarl/issues\u003e`_ that you may\nencounter.\n\n\nUsers\n=====\n\nThe following projects make use of Gnarl |gnarl-icon|:\n\n* `intheam-python \u003chttps://github.com/aperezdc/intheam-python\u003e`__\n* `pebbletime-python \u003chttps://github.com/aperezdc/pebbletime-python\u003e`__\n\n(If you use it, please do not hesitate in editing this file and add a line to\nthis list.)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faperezdc%2Fgnarl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faperezdc%2Fgnarl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faperezdc%2Fgnarl/lists"}