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.1.tar.gz
(10.1 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-2.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6391f32662a215ccc45821e31390585910bffecd0f2b758a67a44a8fbc00cb46 |
|
MD5 | 4b2b3a3e1b12cefaebe5fcb8906ce66a |
|
BLAKE2b-256 | 835e5522152681769a6759e737e733bf4e1a40ec24bee6faead659654c54fd45 |
Close
Hashes for marshmallow_objects-2.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d300283b1d215d53af41c80c185922531887b377abc9cde532de4dea06655ee |
|
MD5 | 2ffa16ca8631ec1c179964cb7d0869a6 |
|
BLAKE2b-256 | 8e5165733d6411bc2623922df2e0ac86c2620374620ddd62e108bb454e3412e2 |