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

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page