Annotype: Python 3 annotations and marshmallow
Annotype combines Python 3 annotations and Marshmallow for powerful validation of function arguments.
from annotype import annotyped
from marshmallow import (
Schema,
fields
)
class PersonSchema(Schema):
firstname = fields.Str(required=True)
lastname = fields.Str(required=True)
@annotyped()
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
salute(person)
@annotyped()
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
Documentation
See marshmallow documentation available here http://marshmallow.readthedocs.io/ .
Requirements
Python >= 3.4
marshmallow >= 3.0.0
License
MIT licensed. See the bundled LICENSE file for more details.
Metadata
Release files for annotype 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| annotype-0.1.2.tar.gz | 3.7 kB | Without provenance | Details for annotype-0.1.2.tar.gz |
Release files / annotype-0.1.2.tar.gz
| Download URL | annotype-0.1.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc048f7e16e1d7d49c8a70f341082fb74d5e72c67d86e8784e1a11f36b1dbf50
|
|
BLAKE2b-256 checksum How to use checksums |
05c6957e4a997db947f0e1b122159a446781cd2b2bdc21fdbd3a03567e832742
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for annotype 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.