odin

Data-structure definition/validation/traversal, mapping and serialisation toolkit for Python

https://github.com/python-odin/odin

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.0%) to scientific vocabulary

Keywords

csv data-mapping data-structures de-serialize json msgpack python serialize validation xml yaml

Keywords from Contributors

cryptocurrencies simulator standards plagiarism-checker action pypi genomics annotation distributed embedded
Last synced: 6 months ago · JSON representation

Repository

Data-structure definition/validation/traversal, mapping and serialisation toolkit for Python

Basic Info
Statistics
  • Stars: 38
  • Watchers: 2
  • Forks: 11
  • Open Issues: 4
  • Releases: 42
Topics
csv data-mapping data-structures de-serialize json msgpack python serialize validation xml yaml
Created over 12 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog Funding License Authors

README.md

Odin

Odin provides a declarative framework for defining resources (classes) and their relationships, validation of the fields that make up the resources and mapping between objects (either a resource, or other python structures).

Odin also comes with built in serialisation tools for importing and exporting data from resources.

Docs/Help ReadTheDocs Gitter.im
Build Python package
Quality Maintainability Security Coverage Once you go Black...
Package Latest Version PyPI - Wheel

Highlights

  • Class based declarative style
  • Class based annotations style! ✨ new in 2.0
  • Fields for building composite resources
  • Field and Resource level validation
  • Easy extension to support custom fields
  • Python 3.8+ and PyPy 1 supported
  • Support for documenting resources with Sphinx
  • Minimal dependencies

1 certain contrib items are not supported. Pint is not installable with PyPy.

Use cases

  • Design, document and validate complex (and simple!) data structures
  • Convert structures to and from different formats such as JSON, YAML, MsgPack, CSV, TOML
  • Validate API inputs
  • Define message formats for communications protocols, like an RPC
  • Map API requests to ORM objects

Quick links

Upcoming features

In development

  • XML Codec (export only)
  • Complete documentation coverage
  • Improvements for CSV Codec (writing, reading multi resource CSV's)

Requires

Optional

  • simplejson - Odin will use simplejson if it is available or fallback to the builtin json library
  • msgpack-python - To enable use of the msgpack codec
  • pyyaml - To enable use of the YAML codec
  • toml - To enable use of the TOML codec

Contrib

  • arrow - Support for Arrow data types.
  • pint - Support for physical quantities using the Pint library.

Development

  • pytest - Testing
  • pytest-cov - Coverage reporting

Example

Definition

```python import odin

class Author(odin.Resource): name = odin.StringField()

class Publisher(odin.Resource): name = odin.StringField()

class Book(odin.Resource): title = odin.StringField() authors = odin.ArrayOf(Author) publisher = odin.DictAs(Publisher) genre = odin.StringField() num_pages = odin.IntegerField() ```

Using Annotations

```python import odin

class Author(odin.AnnotatedResource): name: str

class Publisher(odin.AnnotatedResource): name: str website: odin.Url | None

class Book(odin.AnnotatedResource): title: str authors: list[Author] publisher: Publisher genre: str num_pages: int ```

Usage

```pycon

b = Book( title="Consider Phlebas", genre="Space Opera", publisher=Publisher(name="Macmillan"), numpages=471 ) b.authors.append(Author(name="Iain M. Banks")) from odin.codecs import jsoncodec jsoncodec.dumps(b, indent=4) { "$": "Book", "authors": [ { "$": "Author", "name": "Iain M. Banks" } ], "genre": "Space Opera", "numpages": 471, "publisher": { "$": "Publisher", "name": "Macmillan" }, "title": "Consider Phlebas" } ```

Owner

  • Name: Odin
  • Login: python-odin
  • Kind: organization

GitHub Events

Total
  • Create event: 2
  • Release event: 1
  • Issues event: 3
  • Watch event: 1
  • Delete event: 3
  • Issue comment event: 3
  • Push event: 11
  • Pull request event: 9
Last Year
  • Create event: 2
  • Release event: 1
  • Issues event: 3
  • Watch event: 1
  • Delete event: 3
  • Issue comment event: 3
  • Push event: 11
  • Pull request event: 9

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 1,170
  • Total Committers: 8
  • Avg Commits per committer: 146.25
  • Development Distribution Score (DDS): 0.24
Past Year
  • Commits: 29
  • Committers: 1
  • Avg Commits per committer: 29.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Tim Savage t****m@s****y 889
tims t****s@s****m 209
Omer Katz o****w@g****m 39
pyup-bot g****t@p****o 23
dependabot[bot] 4****] 5
Tim Savage t****e@w****u 3
dependabot-preview[bot] 2****] 1
Viggo de Vries v****o@h****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 30
  • Total pull requests: 98
  • Average time to close issues: about 1 year
  • Average time to close pull requests: about 1 month
  • Total issue authors: 8
  • Total pull request authors: 7
  • Average comments per issue: 2.07
  • Average comments per pull request: 1.23
  • Merged pull requests: 75
  • Bot issues: 0
  • Bot pull requests: 15
Past Year
  • Issues: 3
  • Pull requests: 6
  • Average time to close issues: 13 days
  • Average time to close pull requests: 4 months
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 2.67
  • Average comments per pull request: 0.5
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • timsavage (18)
  • joeyjurjens (3)
  • ronlawrence3 (2)
  • thedrow (2)
  • jokiefer (2)
  • kristianmaras (1)
  • josephfinlayson (1)
  • dependabot[bot] (1)
  • gc-ss (1)
Pull Request Authors
  • timsavage (55)
  • pyup-bot (26)
  • dependabot[bot] (21)
  • thedrow (4)
  • samar-hassan (2)
  • viggo-devries (2)
  • dependabot-preview[bot] (1)
Top Labels
Issue Labels
bug (12) enhancement (10) design-issue (5) question (5) documentation (4) needs-documentation (2) needs-tests (2) help-wanted (1) WIP (1) duplicate (1) dependencies (1)
Pull Request Labels
dependencies (22) enhancement (6) documentation (4) bug (4) needs-tests (2) python (2) contrib (1) design-issue (1) invalid (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 2,357 last-month
  • Total dependent packages: 2
  • Total dependent repositories: 21
  • Total versions: 55
  • Total maintainers: 1
pypi.org: odin

Data-structure definition/validation/traversal, mapping and serialisation toolkit for Python

  • Versions: 55
  • Dependent Packages: 2
  • Dependent Repositories: 21
  • Downloads: 2,357 Last month
Rankings
Dependent repos count: 3.2%
Dependent packages count: 4.7%
Downloads: 7.5%
Average: 7.8%
Stargazers count: 10.9%
Forks count: 12.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

poetry.lock pypi
  • alabaster 0.7.12 develop
  • atomicwrites 1.4.0 develop
  • attrs 21.4.0 develop
  • babel 2.9.1 develop
  • certifi 2021.10.8 develop
  • chardet 4.0.0 develop
  • charset-normalizer 2.0.12 develop
  • colorama 0.4.4 develop
  • configparser 4.0.2 develop
  • contextlib2 0.6.0.post1 develop
  • coverage 5.5 develop
  • docutils 0.17.1 develop
  • idna 3.3 develop
  • idna 2.10 develop
  • imagesize 1.3.0 develop
  • importlib-metadata 2.1.3 develop
  • jinja2 2.11.3 develop
  • markupsafe 1.1.1 develop
  • mock 3.0.5 develop
  • more-itertools 8.12.0 develop
  • more-itertools 5.0.0 develop
  • packaging 20.9 develop
  • pathlib2 2.3.7.post1 develop
  • pluggy 0.13.1 develop
  • py 1.11.0 develop
  • pygments 2.5.2 develop
  • pyparsing 2.4.7 develop
  • pytest 4.6.11 develop
  • pytest-cov 2.12.1 develop
  • pytz 2022.1 develop
  • requests 2.27.1 develop
  • scandir 1.10.0 develop
  • snowballstemmer 2.2.0 develop
  • sphinx 1.8.6 develop
  • sphinxcontrib-websupport 1.1.2 develop
  • urllib3 1.26.9 develop
  • wcwidth 0.2.5 develop
  • zipp 1.2.0 develop
  • arrow 0.17.0
  • backports.functools-lru-cache 1.6.4
  • enum34 1.1.10
  • funcsigs 1.0.2
  • humanfriendly 10.0
  • monotonic 1.6
  • msgpack 1.0.3
  • pint 0.9
  • ply 3.11
  • pyreadline 2.1
  • pyreadline3 3.4.1
  • python-dateutil 2.8.2
  • pyyaml 5.4.1
  • six 1.16.0
  • toml 0.10.2
  • typing 3.7.4.3
pyproject.toml pypi
  • mock * develop
  • pytest * develop
  • pytest-cov * develop
  • sphinx * develop
  • arrow *
  • enum34 *
  • humanfriendly *
  • msgpack *
  • pint *
  • ply *
  • python ~2.7 || >=3.6 <3.10
  • pyyaml *
  • six *
  • toml *
  • typing ~=3.7.4
.github/workflows/codeql-analysis.yml actions
  • actions/checkout v2 composite
  • github/codeql-action/analyze v1 composite
  • github/codeql-action/autobuild v1 composite
  • github/codeql-action/init v1 composite
.github/workflows/manual-release.yml actions
  • actions/checkout v2 composite
  • actions/create-release v1 composite
  • actions/setup-python master composite
  • actions/upload-release-asset v1 composite
.github/workflows/release.yml actions
  • actions/checkout v2 composite
  • actions/create-release v1 composite
  • actions/setup-python master composite
  • actions/upload-release-asset v1 composite
  • pypa/gh-action-pypi-publish v1.5.0 composite
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python master composite
  • sonarsource/sonarcloud-github-action master composite