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.2.0.tar.gz
(17.4 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-2.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a13272069aee6558c647944dc38de2e5e06e5f55cc4d03accb929a4032443dd2 |
|
MD5 | 611129196f2d8ab2d247c49a3bc10193 |
|
BLAKE2b-256 | 466a0173ec43e0c07d9ad334e76d90be5a2d068672962a468ab9570a7bf7b331 |
Close
Hashes for marshmallow_objects-2.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4216ef9244c404bce06b062527fa01c566c17c9d0d1946caacace74ce9a8e267 |
|
MD5 | fbf40eea5c62daf82c5cd3d466341d65 |
|
BLAKE2b-256 | 59585e3394e03606a947278926cc467864733ca6a20cb1e601b2459739904496 |