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.21.tar.gz
(11.0 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-1.0.21.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 139e8b512148dd7aeb1be5eb12e042358b0fe9ec1b9f253ccf1d8ba83e28dda1 |
|
MD5 | 41bd0f0150c00ab5c30edd912f7c84e0 |
|
BLAKE2b-256 | 1e9573b2ea45f59a149dc37515910463b7dfe27728a298f2f717a5b182eeca67 |
Close
Hashes for marshmallow_objects-1.0.21-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54a47ab81340266f9167e229f93f44f3cfe466d1803fe98be4a9ee6145ceca8b |
|
MD5 | 003f0ef99938a069b4d15c1f4e8e5789 |
|
BLAKE2b-256 | 3e09317d5a537dd44baad0f582658025c48bb735b3807802270d604fe186cabb |