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
Built Distribution
File details
Details for the file marshmallow-meta-0.0.1.tar.gz
.
File metadata
- Download URL: marshmallow-meta-0.0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b658764256ef6882657e1393a384c1856edac47c2a9474e56426bbba1133578 |
|
MD5 | 4eca23f6d31393d3707205f9b9698ea8 |
|
BLAKE2b-256 | ea70d2d911bd62e47c3f6048c3b6c63016fa4f5adaed0a56de44e0913680a0b4 |
File details
Details for the file marshmallow_meta-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: marshmallow_meta-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0edf2b12d7a087d6a4f72a5dd93f9eb5c951d8370db9e36d4dceb01e428aa6af |
|
MD5 | 39d5d9e85fc0d396cc59a3f2a0f33eee |
|
BLAKE2b-256 | 1f8fa6af060597b5e47c5f0bd9af964719068842e3c5f84f6e0e2f0d575e35b3 |