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.0.tar.gz
(17.0 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-2.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | abde19ed7730b503738b8d0740587bc925da4b4eb7c6e9401d3ed57e179e2187 |
|
MD5 | a7b23b8d22ffc8ff9151b40ee666c5d9 |
|
BLAKE2b-256 | 2e3227a78e416f5f62e6cebb1c7234a9379db08e882e39516c753381fb50d05d |
Close
Hashes for marshmallow_objects-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3b91957c2f86fe1d91752f9808952bf864c4182eb8bb5640de88e5685774c86 |
|
MD5 | 88e3ba879845fc65b979a6d4edb22659 |
|
BLAKE2b-256 | edcaaca3f1bc405d8892bd856678178be564bd009c8efdb9e903a29457dd152e |