marshmallow-objects
marshmallow-objects
pypi i marshmallow-objects
marshmallow-objects

marshmallow-objects

Marshmallow Objects and Models

by sv-tools

2.3.0 (see all)License:MIT License
pypi i marshmallow-objects
Readme

marshmallow-objects

Test Codecov Version Black

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

License

MIT licensed. See the bundled LICENSE file for more details.

VersionTagPublished
2.3.0
3yrs ago
2.2.3
3yrs ago
2.2.2
3yrs ago
2.2.1
3yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate