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.20.tar.gz
(11.5 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-1.0.20.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 269a42269af3401a5b67068e0cfc09d435134d89cd4cde9927247d33798933d7 |
|
MD5 | ebe012e604c7a9493fe3fae4b9fdd56a |
|
BLAKE2b-256 | 35dd629975f28b87363cf4e2ee2008fb7466a56196647404d8c64f2bb1179702 |
Close
Hashes for marshmallow_objects-1.0.20-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6be3916be47ef7b11253a3efd6e29c0247f06cfbc43298b1daadffb9b8653afe |
|
MD5 | 255c6b9801d74f827ab4c8966b309d9a |
|
BLAKE2b-256 | a9a87e2eecaaf7b8c89bb700662fbe8ad126d85dac833ad52f3f9b11e98f6012 |