decorator syntax for marshmallow meta attributes (with inheritance)
Project description
marshmallow-meta
decorator syntax for marshmallow meta attributes (with inheritance)
Decorators communicate that the behavior of a class is being modified and are more concise when only a few meta attributes are needed. Making inheritance the default further reduces the boilerplate needed to make minor changes to a subclass.
Install
pip install marshmallow-meta
from marshmallow_meta import meta
API
@meta(*kwargs)
Build a meta class that inherits attributes from the base schema's meta class.
@meta(unknown=INCLUDE)
class Test(Schema):
foo = fields.String()
@meta.new(*kwargs)
Build a new meta class without inherited attributes.
@meta.new(fields=('bar', 'baz'))
class Fresh(Test):
pass
@meta.use(*classes, **kwargs)
Build a meta class that inherits attributes from certain meta classes.
@meta.use(Test.Meta)
class CopyCat(Schema):
buzz = fields.String()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
marshmallow-meta-0.0.1.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow_meta-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0edf2b12d7a087d6a4f72a5dd93f9eb5c951d8370db9e36d4dceb01e428aa6af |
|
MD5 | 39d5d9e85fc0d396cc59a3f2a0f33eee |
|
BLAKE2b-256 | 1f8fa6af060597b5e47c5f0bd9af964719068842e3c5f84f6e0e2f0d575e35b3 |