{"id":13494826,"url":"https://github.com/python-odin/odin","last_synced_at":"2025-07-18T05:40:56.876Z","repository":{"id":10158582,"uuid":"12238878","full_name":"python-odin/odin","owner":"python-odin","description":"Data-structure definition/validation/traversal, mapping and serialisation toolkit for Python","archived":false,"fork":false,"pushed_at":"2025-06-18T09:23:11.000Z","size":1922,"stargazers_count":38,"open_issues_count":12,"forks_count":12,"subscribers_count":2,"default_branch":"development","last_synced_at":"2025-06-18T09:31:44.548Z","etag":null,"topics":["csv","data-mapping","data-structures","de-serialize","json","msgpack","python","serialize","validation","xml","yaml"],"latest_commit_sha":null,"homepage":"https://odin.readthedocs.org/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-odin.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"timsavage"}},"created_at":"2013-08-20T09:00:16.000Z","updated_at":"2025-06-18T09:23:15.000Z","dependencies_parsed_at":"2023-01-13T15:46:23.477Z","dependency_job_id":"6caee3ff-2f52-4c36-807a-00e8e655e5b9","html_url":"https://github.com/python-odin/odin","commit_stats":{"total_commits":1120,"total_committers":8,"mean_commits":140.0,"dds":0.56875,"last_synced_commit":"3cfaa5bf442829f76cd1e145b6b9105897ff3488"},"previous_names":[],"tags_count":72,"template":false,"template_full_name":null,"purl":"pkg:github/python-odin/odin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-odin%2Fodin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-odin%2Fodin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-odin%2Fodin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-odin%2Fodin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-odin","download_url":"https://codeload.github.com/python-odin/odin/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-odin%2Fodin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265705757,"owners_count":23814497,"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":["csv","data-mapping","data-structures","de-serialize","json","msgpack","python","serialize","validation","xml","yaml"],"created_at":"2024-07-31T19:01:28.596Z","updated_at":"2025-07-18T05:40:56.858Z","avatar_url":"https://github.com/python-odin.png","language":"Python","readme":"\n####\nOdin\n####\n\nOdin provides a declarative framework for defining resources (classes) and their relationships, validation of the fields\nthat make up the resources and mapping between objects (either a resource, or other python structures).\n\nOdin also comes with built in serialisation tools for importing and exporting data from resources.\n\n+---------+-------------------------------------------------------------------------------------------------------------+\n| Docs/   | .. image:: https://readthedocs.org/projects/odin/badge/?version=latest                                      |\n| Help    |    :target: https://odin.readthedocs.org/                                                                   |\n|         |    :alt: ReadTheDocs                                                                                        |\n|         | .. image:: https://img.shields.io/badge/gitterim-timsavage.odin-brightgreen.svg?style=flat                  |\n|         |    :target: https://gitter.im/timsavage/odin                                                                |\n|         |    :alt: Gitter.im                                                                                          |\n+---------+-------------------------------------------------------------------------------------------------------------+\n| Build   | .. image:: https://github.com/python-odin/odin/actions/workflows/python-package.yml/badge.svg               |\n|         |    :target: https://github.com/python-odin/odin/actions/workflows/python-package.yml                        |\n|         |    :alt: Python package                                                                                     |\n+---------+-------------------------------------------------------------------------------------------------------------+\n| Quality | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin\u0026metric=sqale_rating    |\n|         |    :target: https://sonarcloud.io/dashboard?id=python-odin_odin                                             |\n|         |    :alt: Maintainability                                                                                    |\n|         | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin\u0026metric=security_rating |\n|         |    :target: https://sonarcloud.io/project/security_hotspots                                                 |\n|         |    :alt: Security                                                                                           |\n|         | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin\u0026metric=coverage        |\n|         |    :target: https://sonarcloud.io/code?id=python-odin_odin                                                  |\n|         |    :alt: Test Coverage                                                                                      |\n|         | .. image:: https://img.shields.io/badge/code%20style-black-000000.svg                                       |\n|         |    :target: https://github.com/ambv/black                                                                   |\n|         |    :alt: Once you go Black...                                                                               |\n+---------+-------------------------------------------------------------------------------------------------------------+\n| Package | .. image:: https://img.shields.io/pypi/v/odin                                                               |\n|         |    :target: https://pypi.io/pypi/odin/                                                                      |\n|         |    :alt: Latest Version                                                                                     |\n|         | .. image:: https://img.shields.io/pypi/pyversions/odin                                                      |\n|         |    :target: https://pypi.io/pypi/odin/                                                                      |\n|         | .. image:: https://img.shields.io/pypi/l/odin                                                               |\n|         |    :target: https://pypi.io/pypi/odin/                                                                      |\n|         | .. image:: https://img.shields.io/pypi/wheel/odin                                                           |\n|         |    :alt: PyPI - Wheel                                                                                       |\n|         |    :target: https://pypi.io/pypi/odin/                                                                      |\n+---------+-------------------------------------------------------------------------------------------------------------+\n\n\nHighlights\n**********\n\n* Class based declarative style\n* Class based annotations style! ✨ new in 2.0\n* Fields for building composite resources\n* Field and Resource level validation\n* Easy extension to support custom fields\n* Python 3.8+ and PyPy :sup:`1` supported\n* Support for documenting resources with `Sphinx \u003chttp://sphinx-doc.org/\u003e`_\n* Minimal dependencies\n\n:sup:`1` certain contrib items are not supported. Pint is not installable with PyPy.\n\nUse cases\n*********\n* Design, document and validate complex (and simple!) data structures\n* Convert structures to and from different formats such as JSON, YAML, MsgPack, CSV, TOML\n* Validate API inputs\n* Define message formats for communications protocols, like an RPC\n* Map API requests to ORM objects\n\nQuick links\n***********\n\n* `Documentation \u003chttps://odin.readthedocs.org/\u003e`_\n* `Project home \u003chttps://github.com/python-odin/odin\u003e`_\n* `Issue tracker \u003chttps://github.com/python-odin/odin/issues\u003e`_\n\n\nUpcoming features\n*****************\n\n**In development**\n\n* XML Codec (export only)\n* Complete documentation coverage\n* Improvements for CSV Codec (writing, reading multi resource CSV's)\n\n\nRequires\n********\n\n**Optional**\n\n* simplejson - Odin will use simplejson if it is available or fallback to the builtin json library\n* msgpack-python - To enable use of the msgpack codec\n* pyyaml - To enable use of the YAML codec\n* toml - To enable use of the TOML codec\n\n**Contrib**\n\n* arrow - Support for Arrow data types.\n* pint - Support for physical quantities using the `Pint \u003chttp://pint.readthedocs.org/\u003e`_ library.\n\n**Development**\n\n* pytest - Testing\n* pytest-cov - Coverage reporting\n\nExample\n*******\n\n**Definition**\n\n.. code-block:: python\n\n    import odin\n\n    class Author(odin.Resource):\n        name = odin.StringField()\n\n    class Publisher(odin.Resource):\n        name = odin.StringField()\n\n    class Book(odin.Resource):\n        title = odin.StringField()\n        authors = odin.ArrayOf(Author)\n        publisher = odin.DictAs(Publisher)\n        genre = odin.StringField()\n        num_pages = odin.IntegerField()\n\n**Using Annotations**\n\n.. code-block:: python\n\n    import odin\n\n    class Author(odin.AnnotatedResource):\n        name: str\n\n    class Publisher(odin.AnnotatedResource):\n        name: str\n        website: Optional[odin.Url]\n\n    class Book(odin.AnnotatedResource):\n        title: str\n        authors: List[Author]\n        publisher: Publisher\n        genre: str\n        num_pages: int\n\n**Usage**::\n\n    \u003e\u003e\u003e b = Book(\n            title=\"Consider Phlebas\",\n            genre=\"Space Opera\",\n            publisher=Publisher(name=\"Macmillan\"),\n            num_pages=471\n        )\n    \u003e\u003e\u003e b.authors.append(Author(name=\"Iain M. Banks\"))\n    \u003e\u003e\u003e from odin.codecs import json_codec\n    \u003e\u003e\u003e json_codec.dumps(b, indent=4)\n    {\n        \"$\": \"Book\",\n        \"authors\": [\n            {\n                \"$\": \"Author\",\n                \"name\": \"Iain M. Banks\"\n            }\n        ],\n        \"genre\": \"Space Opera\",\n        \"num_pages\": 471,\n        \"publisher\": {\n            \"$\": \"Publisher\",\n            \"name\": \"Macmillan\"\n        },\n        \"title\": \"Consider Phlebas\"\n    }\n\n\n","funding_links":["https://github.com/sponsors/timsavage"],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-odin%2Fodin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-odin%2Fodin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-odin%2Fodin/lists"}