Metadata-Version: 2.1
Name: desert
Version: 2020.11.18
Summary: Deserialize to objects while staying DRY
Home-page: https://github.com/python-desert/desert
Author: Desert contributors
Author-email: python-desert@users.noreply.github.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Utilities
Requires-Python: >=3.6
Requires-Dist: marshmallow (>=3.0)
Requires-Dist: attrs
Requires-Dist: typing-inspect
Requires-Dist: dataclasses ; python_version < "3.7"
Provides-Extra: dev
Requires-Dist: coverage ; extra == 'dev'
Requires-Dist: cuvner ; extra == 'dev'
Requires-Dist: marshmallow-enum ; extra == 'dev'
Requires-Dist: marshmallow-union ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Requires-Dist: pytest-sphinx ; extra == 'dev'
Requires-Dist: pytest-travis-fold ; extra == 'dev'
Requires-Dist: tox ; extra == 'dev'
Requires-Dist: importlib-metadata ; extra == 'dev'
Requires-Dist: versioneer ; extra == 'dev'
Requires-Dist: black ; extra == 'dev'
Requires-Dist: pylint ; extra == 'dev'
Requires-Dist: pex ; extra == 'dev'
Requires-Dist: bump2version ; extra == 'dev'
Requires-Dist: docutils ; extra == 'dev'
Requires-Dist: check-manifest ; extra == 'dev'
Requires-Dist: readme-renderer ; extra == 'dev'
Requires-Dist: pygments ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'
Requires-Dist: towncrier ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: wheel ; extra == 'dev'
Provides-Extra: test
Requires-Dist: coverage ; extra == 'test'
Requires-Dist: cuvner ; extra == 'test'
Requires-Dist: marshmallow-enum ; extra == 'test'
Requires-Dist: marshmallow-union ; extra == 'test'
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: pytest-sphinx ; extra == 'test'
Requires-Dist: pytest-travis-fold ; extra == 'test'
Requires-Dist: tox ; extra == 'test'
Requires-Dist: importlib-metadata ; extra == 'test'

===============================
Desert: DRY deserialization
===============================




Desert generates serialization schemas for ``dataclasses`` and ``attrs`` classes. Writing
code that's DRY ("don't repeat yourself") helps avoid bugs and improve readability. Desert
helps you write code that's DRY.







Installation
============

::

    pip install desert

or with `Poetry`_

::

   poetry add desert


Usage
=========

..
    start-basic-usage

A simple example models two ``Person`` objects in a ``Car``.

.. code-block:: python



        from dataclasses import dataclass

        # Or using attrs
        # from attr import dataclass

        from typing import List

	import desert

        @dataclass
        class Person:
            name: str
            age: int

        @dataclass
        class Car:
            passengers: List[Person]

        # Load some simple data types.
        data = {'passengers': [{'name': 'Alice', 'age': 21}, {'name': 'Bob', 'age': 22}]}


        # Create a schema for the Car class.
        schema = desert.schema(Car)

        # Load the data.
        car = schema.load(data)
        assert car == Car(passengers=[Person(name='Alice', age=21), Person(name='Bob', age=22)])


..
    end-basic-usage

Documentation
=============


https://desert.readthedocs.io/


Limitations
============

String annotations and forward references inside of functions are not supported.





Acknowledgements
=================

- This package began as an extension of marshmallow-dataclass_ to add support for attrs_.


.. _Poetry: https://poetry.eustace.io
.. _marshmallow-dataclass: https://pypi.org/project/marshmallow-dataclass/
.. _attrs: http://www.attrs.org/

2020.11.18 (2020-11-18)
-----------------------


Changes
^^^^^^^

- Schemas no longer copy non-field dataclass attributes. Thanks to @sveinse for report and test.
  `#79 <https://github.com/python-desert/desert/issues/79>`_


----


2020.01.06 (2020-01-06)
-----------------------


Changes
^^^^^^^

- Additional metadata are supported in ib() and fields(). Thanks to @sveinse for reporting and testing.
  `#28 <https://github.com/python-desert/desert/issues/28>`_


----


2020.01.05 (2020-01-05)
-----------------------


Changes
^^^^^^^

- Add support for attrs factories that take ``self`` (``attr.Factory(..., takes_self=True)``).
  `#27 <https://github.com/python-desert/desert/issues/27>`_


----


2020.01.04 (2020-01-04)
-----------------------


Changes
^^^^^^^

- Add support for Tuple[int, ...] per https://docs.python.org/3/library/typing.html#typing.Tuple
  `#16 <https://github.com/python-desert/desert/issues/16>`_ Thanks to @sveinse for reporting and testing.
- Use module imports internally.
  `#18 <https://github.com/python-desert/desert/issues/18>`_
- Desert version only needs to be updated in _version.py
  `#19 <https://github.com/python-desert/desert/issues/19>`_
- Fix doctests.
  `#20 <https://github.com/python-desert/desert/issues/20>`_


----


2020.01.03
--------------

Changes
^^^^^^^^

- ``Optional`` fields allow ``None``. `#11 <https://github.com/python-desert/desert/issues/11>`__. Thanks to @sveinse for reporting and testing.

2019.12.18
--------------

Changes
^^^^^^^

- Improve error message for unknown generics.
  `#10 <https://github.com/python-desert/desert/pull/10>`_

2019.12.10
--------------

Changes
^^^^^^^

- Add ``UnknownType`` exception with better error message for types that should be generic.
  `#8  <https://github.com/python-desert/desert/issues/8>`_



2019.12.09
--------------

Changes
^^^^^^^

- Marshmallow schema ``Meta`` arguments are accepted, allowing exclusion of unknown fields and other options.
  `#3  <https://github.com/python-desert/desert/pull/3>`_

2019.11.06 (2019-11-06)
-----------------------


Changes
^^^^^^^

- Add twine and wheel development dependencies.
  `#2 <https://github.com/python-desert/desert/issues/2>`_


----


2019.11.06 (2019-11-06)
-----------------------

Changes
^^^^^^^

- Switch to calver


Backward-incompatible Changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Non-optional fields without a default or factory now have `required=True` so raise ``marshmallow.exceptions.ValidationError`` when missing.
  `#1 <https://github.com/python-desert/desert/issues/1>`_


----

0.1.0 (2019-06-22)
------------------

Changes
^^^^^^^

- First release on PyPI.

---


