%global _empty_manifest_terminate_build 0 Name: python-odin Version: 2.8 Release: 1 Summary: Data-structure definition/validation/traversal, mapping and serialisation toolkit for Python License: BSD-3-Clause URL: https://github.com/python-odin/odin Source0: https://mirrors.aliyun.com/pypi/web/packages/23/12/6d0070b78312fd5f1249979da59e7f52e832f9848db09e537ccdb5336d1d/odin-2.8.tar.gz BuildArch: noarch Requires: python3-arrow Requires: python3-msgpack Requires: python3-pint Requires: python3-pyyaml Requires: python3-rich Requires: python3-toml %description #### 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/ | .. image:: https://readthedocs.org/projects/odin/badge/?version=latest | | Help | :target: https://odin.readthedocs.org/ | | | :alt: ReadTheDocs | | | .. image:: https://img.shields.io/badge/gitterim-timsavage.odin-brightgreen.svg?style=flat | | | :target: https://gitter.im/timsavage/odin | | | :alt: Gitter.im | +---------+-------------------------------------------------------------------------------------------------------------+ | Build | .. image:: https://github.com/python-odin/odin/actions/workflows/python-package.yml/badge.svg | | | :target: https://github.com/python-odin/odin/actions/workflows/python-package.yml | | | :alt: Python package | +---------+-------------------------------------------------------------------------------------------------------------+ | Quality | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=sqale_rating | | | :target: https://sonarcloud.io/dashboard?id=python-odin/odin | | | :alt: Maintainability | | | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=security_rating | | | :target: https://sonarcloud.io/project/security_hotspots | | | :alt: Security | | | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=coverage | | | :target: https://sonarcloud.io/code?id=python-odin_odin | | | :alt: Test Coverage | | | .. image:: https://img.shields.io/badge/code%20style-black-000000.svg | | | :target: https://github.com/ambv/black | | | :alt: Once you go Black... | +---------+-------------------------------------------------------------------------------------------------------------+ | Package | .. image:: https://img.shields.io/pypi/v/odin | | | :target: https://pypi.io/pypi/odin/ | | | :alt: Latest Version | | | .. image:: https://img.shields.io/pypi/pyversions/odin | | | :target: https://pypi.io/pypi/odin/ | | | .. image:: https://img.shields.io/pypi/l/odin | | | :target: https://pypi.io/pypi/odin/ | | | .. image:: https://img.shields.io/pypi/wheel/odin | | | :alt: PyPI - Wheel | | | :target: https://pypi.io/pypi/odin/ | +---------+-------------------------------------------------------------------------------------------------------------+ 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 :sup:`1` supported * Support for documenting resources with `Sphinx `_ * Minimal dependencies :sup:`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 *********** * `Documentation `_ * `Project home `_ * `Issue tracker `_ 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** .. code-block:: 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** .. code-block:: python import odin class Author(odin.AnnotatedResource): name: str class Publisher(odin.AnnotatedResource): name: str website: Optional[odin.Url] class Book(odin.AnnotatedResource): title: str authors: List[Author] publisher: Publisher genre: str num_pages: int **Usage**:: >>> b = Book( title="Consider Phlebas", genre="Space Opera", publisher=Publisher(name="Macmillan"), num_pages=471 ) >>> b.authors.append(Author(name="Iain M. Banks")) >>> from odin.codecs import json_codec >>> json_codec.dumps(b, indent=4) { "$": "Book", "authors": [ { "$": "Author", "name": "Iain M. Banks" } ], "genre": "Space Opera", "num_pages": 471, "publisher": { "$": "Publisher", "name": "Macmillan" }, "title": "Consider Phlebas" } %package -n python3-odin Summary: Data-structure definition/validation/traversal, mapping and serialisation toolkit for Python Provides: python-odin BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-odin #### 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/ | .. image:: https://readthedocs.org/projects/odin/badge/?version=latest | | Help | :target: https://odin.readthedocs.org/ | | | :alt: ReadTheDocs | | | .. image:: https://img.shields.io/badge/gitterim-timsavage.odin-brightgreen.svg?style=flat | | | :target: https://gitter.im/timsavage/odin | | | :alt: Gitter.im | +---------+-------------------------------------------------------------------------------------------------------------+ | Build | .. image:: https://github.com/python-odin/odin/actions/workflows/python-package.yml/badge.svg | | | :target: https://github.com/python-odin/odin/actions/workflows/python-package.yml | | | :alt: Python package | +---------+-------------------------------------------------------------------------------------------------------------+ | Quality | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=sqale_rating | | | :target: https://sonarcloud.io/dashboard?id=python-odin/odin | | | :alt: Maintainability | | | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=security_rating | | | :target: https://sonarcloud.io/project/security_hotspots | | | :alt: Security | | | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=coverage | | | :target: https://sonarcloud.io/code?id=python-odin_odin | | | :alt: Test Coverage | | | .. image:: https://img.shields.io/badge/code%20style-black-000000.svg | | | :target: https://github.com/ambv/black | | | :alt: Once you go Black... | +---------+-------------------------------------------------------------------------------------------------------------+ | Package | .. image:: https://img.shields.io/pypi/v/odin | | | :target: https://pypi.io/pypi/odin/ | | | :alt: Latest Version | | | .. image:: https://img.shields.io/pypi/pyversions/odin | | | :target: https://pypi.io/pypi/odin/ | | | .. image:: https://img.shields.io/pypi/l/odin | | | :target: https://pypi.io/pypi/odin/ | | | .. image:: https://img.shields.io/pypi/wheel/odin | | | :alt: PyPI - Wheel | | | :target: https://pypi.io/pypi/odin/ | +---------+-------------------------------------------------------------------------------------------------------------+ 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 :sup:`1` supported * Support for documenting resources with `Sphinx `_ * Minimal dependencies :sup:`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 *********** * `Documentation `_ * `Project home `_ * `Issue tracker `_ 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** .. code-block:: 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** .. code-block:: python import odin class Author(odin.AnnotatedResource): name: str class Publisher(odin.AnnotatedResource): name: str website: Optional[odin.Url] class Book(odin.AnnotatedResource): title: str authors: List[Author] publisher: Publisher genre: str num_pages: int **Usage**:: >>> b = Book( title="Consider Phlebas", genre="Space Opera", publisher=Publisher(name="Macmillan"), num_pages=471 ) >>> b.authors.append(Author(name="Iain M. Banks")) >>> from odin.codecs import json_codec >>> json_codec.dumps(b, indent=4) { "$": "Book", "authors": [ { "$": "Author", "name": "Iain M. Banks" } ], "genre": "Space Opera", "num_pages": 471, "publisher": { "$": "Publisher", "name": "Macmillan" }, "title": "Consider Phlebas" } %package help Summary: Development documents and examples for odin Provides: python3-odin-doc %description help #### 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/ | .. image:: https://readthedocs.org/projects/odin/badge/?version=latest | | Help | :target: https://odin.readthedocs.org/ | | | :alt: ReadTheDocs | | | .. image:: https://img.shields.io/badge/gitterim-timsavage.odin-brightgreen.svg?style=flat | | | :target: https://gitter.im/timsavage/odin | | | :alt: Gitter.im | +---------+-------------------------------------------------------------------------------------------------------------+ | Build | .. image:: https://github.com/python-odin/odin/actions/workflows/python-package.yml/badge.svg | | | :target: https://github.com/python-odin/odin/actions/workflows/python-package.yml | | | :alt: Python package | +---------+-------------------------------------------------------------------------------------------------------------+ | Quality | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=sqale_rating | | | :target: https://sonarcloud.io/dashboard?id=python-odin/odin | | | :alt: Maintainability | | | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=security_rating | | | :target: https://sonarcloud.io/project/security_hotspots | | | :alt: Security | | | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=coverage | | | :target: https://sonarcloud.io/code?id=python-odin_odin | | | :alt: Test Coverage | | | .. image:: https://img.shields.io/badge/code%20style-black-000000.svg | | | :target: https://github.com/ambv/black | | | :alt: Once you go Black... | +---------+-------------------------------------------------------------------------------------------------------------+ | Package | .. image:: https://img.shields.io/pypi/v/odin | | | :target: https://pypi.io/pypi/odin/ | | | :alt: Latest Version | | | .. image:: https://img.shields.io/pypi/pyversions/odin | | | :target: https://pypi.io/pypi/odin/ | | | .. image:: https://img.shields.io/pypi/l/odin | | | :target: https://pypi.io/pypi/odin/ | | | .. image:: https://img.shields.io/pypi/wheel/odin | | | :alt: PyPI - Wheel | | | :target: https://pypi.io/pypi/odin/ | +---------+-------------------------------------------------------------------------------------------------------------+ 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 :sup:`1` supported * Support for documenting resources with `Sphinx `_ * Minimal dependencies :sup:`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 *********** * `Documentation `_ * `Project home `_ * `Issue tracker `_ 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** .. code-block:: 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** .. code-block:: python import odin class Author(odin.AnnotatedResource): name: str class Publisher(odin.AnnotatedResource): name: str website: Optional[odin.Url] class Book(odin.AnnotatedResource): title: str authors: List[Author] publisher: Publisher genre: str num_pages: int **Usage**:: >>> b = Book( title="Consider Phlebas", genre="Space Opera", publisher=Publisher(name="Macmillan"), num_pages=471 ) >>> b.authors.append(Author(name="Iain M. Banks")) >>> from odin.codecs import json_codec >>> json_codec.dumps(b, indent=4) { "$": "Book", "authors": [ { "$": "Author", "name": "Iain M. Banks" } ], "genre": "Space Opera", "num_pages": 471, "publisher": { "$": "Publisher", "name": "Macmillan" }, "title": "Consider Phlebas" } %prep %autosetup -n odin-2.8 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-odin -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri Jun 09 2023 Python_Bot - 2.8-1 - Package Spec generated