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.22.tar.gz
(11.1 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-1.0.22.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 864a9770c7e5a1ae0fd1492af4e75091fee88433cee942d0e4b409380c56dab8 |
|
MD5 | 3250b939623302813f181bf1481d0802 |
|
BLAKE2b-256 | 7e3bf7a3e5d32652f42f064d44274ab57dc54d912defb31a3144bc2ed43e3ffb |
Close
Hashes for marshmallow_objects-1.0.22-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7948c961ee42e895642128e16a5ee46ba7e7f97ea410da656013298a3865d8d |
|
MD5 | 6e6c4a8e721978c11bb0f8829d0e311b |
|
BLAKE2b-256 | fd0a1330264de183f1ff93c4307b6e7ef5c7f12e90e7ab8221ddad2f62c73fec |