Welcome to attrsmallow Documentation
attrs is a powerful library helps you to write concise and correct classes. And marshmallow is a powerful framework to write serializer/deserializer and data validator for complex object.
attrsmallow is a glue layer to taking advantage from them.
Quick Links
Usage
A blog example:
import attr
import marshmallow
from attrsmallow import BaseModel, BaseSchema
@attr.s
class User(BaseModel):
id = attr.ib()
name = attr.ib()
class UserSchema(BaseSchema):
id = fields.Integer(required=True)
name = fields.String(required=True)
Model = User
User.Schema = UserSchema
@attr.s
class Post(BaseModel):
id = attr.ib()
title = attr.ib()
user = attr.ib()
class PostSchema(BaseSchema):
id = fields.Integer()
title = fields.String()
user = fields.Nested(UserSchema)
Model = Post
Post.Schema = PostSchema
post_data = dict(id=1, title="Hello World!", user=dict(id=1, name="Alice"))
post = Post.load(post_data)
Install
attrsmallow is released on PyPI, so all you need is:
$ pip install attrsmallow
To upgrade to latest version:
$ pip install --upgrade attrsmallow
Metadata
Release files for attrsmallow 0.0.1
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 |
|---|---|---|---|---|
| attrsmallow-0.0.1.tar.gz | 9.5 kB | Without provenance | Details for attrsmallow-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| attrsmallow-0.0.1-py2-none-any.whl | Python 2 | none | any | Details for attrsmallow-0.0.1-py2-none-any.whl |
Total release size: 24.7 kB
Release files / attrsmallow-0.0.1.tar.gz
| Download URL | attrsmallow-0.0.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f25cef4da0577691ced8a8cd2273aedff008dd3852f1f6bf630d283af8e8113
|
|
BLAKE2b-256 checksum How to use checksums |
131654447bb60e5f3b4c3367b8b8291e47b2d9a9a62062a13eed00248cf9764c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / attrsmallow-0.0.1-py2-none-any.whl
| Download URL | attrsmallow-0.0.1-py2-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
f13db76d5390abf6697035da66c37b342e15ea9e474cc7bb1466f2974a03a092
|
|
BLAKE2b-256 checksum How to use checksums |
8e5a511d4ae7c8650db9b066a3c0c1097420f691eef911a5ebca5eb5f6dd6c9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for attrsmallow 0.0.1
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.