Skip to main content

Marshmallow and Python 3 annotations

Project description

Annotype combines Python 3 annotations and Marshmallow for powerful validation of function arguments.

from annotype import annotyped
from marshmallow import (

class PersonSchema(Schema):
    firstname = fields.Str(required=True)
    lastname = fields.Str(required=True)

def salute(person: PersonSchema):
    print 'Hello {} {}'.format(person['firstname'], person['lastname'])

person = dict(firstname='John')

# This will raise a ValidationError because lastname is not defined

def welcome(firstname: fields.Str(), lastname: fields.Str()):
    print 'Welcome {} {}'.format(firstname, lastname)

# This will also raise a ValidationError because lastname is not a string
welcome('Jane', 1)

In short, annotype allows you to validate data using the powerful marshmallow library and the Python 3 annotations.

Get It Now

$ pip install -U annotype


See marshmallow documentation available here .


  • Python >= 3.4
  • marshmallow >= 3.0.0


MIT licensed. See the bundled LICENSE file for more details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
annotype-0.1.2.tar.gz (3.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page