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.19.tar.gz
(11.1 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-1.0.19.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 558af1acbc1a647bd6e87802e156dad1aa91deea0e808ff744eace6e953d78d6 |
|
MD5 | 17f8b306051336710fbf5897e7e87cf7 |
|
BLAKE2b-256 | 4bc9ce0cd8dc818c535c7df59f8d0c2bc66945a27980dbb04cb1ee97830f5e7c |
Close
Hashes for marshmallow_objects-1.0.19-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 915a678282f45120d99f771453f2b720031664621adfb3e3b01aae5ebc5a5acb |
|
MD5 | 1342804988ee0b878517bb7f70fcd7cb |
|
BLAKE2b-256 | a8ef14a4c08bf6c3ed4ede5dc695c259912542b5ebbe903f5f1161510f2270cc |