Skip to main content

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.

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

marshmallow-annotations-1.0.0.tar.gz (1.8 kB view hashes)

Uploaded Source

Built Distribution

marshmallow_annotations-1.0.0-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page