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-2.2.2.tar.gz
(17.5 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-2.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c8a213ff3693f7eb25f574b3108db26c0d098692ebca2574450067a2fc6ddcf |
|
MD5 | d1955234d30a560c9c5715ea65e881a5 |
|
BLAKE2b-256 | 7fae7d8b6a7da0631051b743d1b7b2871dd7deb2843d67c4892e74821730d37f |
Close
Hashes for marshmallow_objects-2.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e7f1b415a167568791436199f403ddc2160d20c9421347331c70cf92f509b47 |
|
MD5 | 286891808ba837e64f754b1dd6d3569c |
|
BLAKE2b-256 | 4a81ca628b8ab6fcd02ff3bd9c028f8776bbfa3f049c825436b0025e5b4427fc |