Allows declaring marshmallow fields as annotations
Project description
====================
marshmallow-annotations
====================
.. code-block:: python
from marshmallow_annotations import AnnotatedSchema
from marshmallow import fields
class BookSchema(AnnotatedSchema):
author: fields.String()
title: fields.String()
published: fields.Date()
book = dict(author='Anne Droid', title='Robots', published='3000-01-23')
BookSchema().dump(book).data
# {
# 'author': 'Anne Droid',
# 'title': 'Robots',
# 'published': date(3000, 1, 23)
# }
Install
=======
.. code-block:: bash
pip install marshmallow-annotations
Why?
====
Why not? Type annotations are pretty cool and so is marshmallow, it's like the chocolate peanut butter cup of data validation.
marshmallow-annotations
====================
.. code-block:: python
from marshmallow_annotations import AnnotatedSchema
from marshmallow import fields
class BookSchema(AnnotatedSchema):
author: fields.String()
title: fields.String()
published: fields.Date()
book = dict(author='Anne Droid', title='Robots', published='3000-01-23')
BookSchema().dump(book).data
# {
# 'author': 'Anne Droid',
# 'title': 'Robots',
# 'published': date(3000, 1, 23)
# }
Install
=======
.. code-block:: bash
pip install marshmallow-annotations
Why?
====
Why not? Type annotations are pretty cool and so is marshmallow, it's like the chocolate peanut butter cup of data validation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for marshmallow-annotations-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 552f51a9ca9f747cb27f2daed6af9531a106907e5cde29a9a566456811106c44 |
|
MD5 | 0d9300df0b57a8de2cb2c62820e428dc |
|
BLAKE2b-256 | a2551c67be07d02f68899e92dc48568d429126ff17701364bf58021ba933c944 |
Close
Hashes for marshmallow_annotations-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12f139667eafae0fd41d82a4036dcc82427c250d86293244191e971447c7b1ea |
|
MD5 | 255f31bee15b647abcaba1ad9e05324c |
|
BLAKE2b-256 | adec6e9bcd6d62ccadeeb415fda723833e5fb3d9fa83006e612cafb8c2ae031a |