Skip to main content

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


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)

Uploaded Source

Built Distribution

marshmallow_meta-0.0.1-py3-none-any.whl (2.9 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