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.3.tar.gz
(17.6 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow-objects-2.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10ae8f207e517f8ac7350d85bd5a0a585d949c34b8eaa9376e68158806bd1a41 |
|
MD5 | 9305e58c6948e981501da4d8a98465d5 |
|
BLAKE2b-256 | 9fc9d54a3c94694624c5fd38e4df51ccc97893da6283ddce79bc83b051f08858 |
Close
Hashes for marshmallow_objects-2.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dbf27cb348a9e7ce1153c62615e2ba8ffaa98b39c1e0beb90ae51cf7e962cf3 |
|
MD5 | f221b5ce4e8859b1981ed5ea0f0a92c4 |
|
BLAKE2b-256 | 1e4345446369d808db5b353c0a814551b0bb19567312394fb46681a2c6bd9304 |