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.1.1.tar.gz
(16.2 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-2.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7c82c234e6cd3716cf1e2cd532102cb463692cb6a68fd1eca70431df7a60bcd |
|
MD5 | 6a95e7c71dd55ad1f86696f2bf592fe9 |
|
BLAKE2b-256 | 0ba1c9c5d2a42e21791d1105d8863a3e35654aff070015607dd00aa27c9ae515 |
Close
Hashes for marshmallow_objects-2.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa5e10bc42d2f1e2b907265c2b2f4de5d8c6580e6c0e25727b55016208cc8a4b |
|
MD5 | 93d204ea05af29dd5c1ea5a3e906f0f0 |
|
BLAKE2b-256 | 6cf7bcc05b84a430899738dd1336659c0bd88346c01dcd360fce384d68b998c3 |