Marshmallow Objects and Models
Project description
marshmallow-objects
Marshmallow Objects and Models
Serializing/Deserializing Python objects using Marshmallow library.
import marshmallow_objects as marshmallow
class Artist(marshmallow.Model):
name = marshmallow.fields.Str()
class Album(marshmallow.Model):
title = marshmallow.fields.Str()
release_date = marshmallow.fields.Date()
artist = marshmallow.NestedModel(Artist)
bowie_raw = dict(name='David Bowie')
album_raw = dict(artist=bowie_raw, title='Hunky Dory',
release_date='1971-12-17')
album = Album(**album_raw)
print(album.title)
print(album.release_date)
print(album.artist.name)
# Hunky Dory
# 1971-12-17
# David Bowie
Get It Now
$ pip install -U marshmallow-objects
Project Links
License
MIT licensed. See the bundled LICENSE file for more details.
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-objects-1.0.17.tar.gz
(10.8 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-1.0.17.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f5aafc5a2928cfed5bbf7ccdc6b43fe3de9ccb2a1e3aad40c14351e788d5feb |
|
MD5 | ef077766d78b0d177048684c5e8cbe5e |
|
BLAKE2b-256 | c9683c661a7040b2396fe51d6ff05b326218821debdf78dbdc8bb1b8ab49c577 |
Close
Hashes for marshmallow_objects-1.0.17-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd9ac07892d22b604e5bd4f33ae64ca40ecfeda401c175d7f0f1d2beb041ddd8 |
|
MD5 | 1fb7e8aae46e6454102a6149addaf505 |
|
BLAKE2b-256 | 9eaec044161526096617ed2523749ae3187449910b83dae12610f30a42672fae |