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.1.tar.gz
(17.4 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-2.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3303c0f9063fb93799d3579bf2d7942ae95e55532b234609c45386b1534e70aa |
|
MD5 | f1052c2afa37e8ba76cd303440a9e21b |
|
BLAKE2b-256 | b8395a013c98505992cedb8ef93ec4e0fce3b85f5c886f017b3599030bea97a6 |
Close
Hashes for marshmallow_objects-2.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fc9d772ae533472fd185ff1b85bff9cc23cd8edef8dff870b8fa0b8c82c0a19 |
|
MD5 | a620127001ddddb26c60035ec6873f86 |
|
BLAKE2b-256 | 81368b6c4a4d56c283ca9a19258d2b6e292236f9f4b890de78948af1f24ab886 |