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.0.0.tar.gz
(10.2 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-2.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d74872914483d56f9d26c71c51a0a8f90541dffcb718486125c3373b0f2805 |
|
MD5 | f58d390e91362654b3023981e4653612 |
|
BLAKE2b-256 | 6f7b2557aba0f8fe7af29d830b4e434264dd93f5f0095eb764c4e2e755826d2e |
Close
Hashes for marshmallow_objects-2.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f3f5a09ab5f0dfac1a609be9b98fe46d571e33f74f745485a6eb5235aa019bc |
|
MD5 | c0e9b2fd053d3a834954deb1d7b7a758 |
|
BLAKE2b-256 | 4d1cfe15bc370707e8f8db09ab0edead45ab413b75795a8be523ca6482152183 |