Metadata-Version: 1.1
Name: toastedmarshmallow-enum
Version: 1.0.1
Summary: ['The Toasted Marshmallow Enum package makes it possible to dump and load Enum values based on the ultra fast serialization that Toasted Marshmallow provides.']
Home-page: https://gitlab.com/py-ddd/toastedmarshmallow-enum
Author: Victor Klapholz
Author-email: victor.klapholz@gmail.com
License: apache2
Description: **********************************************************
        :fire:toastedmarshmallow-enum:fire:: Dumps and Loads Enums
        **********************************************************
        
        Inspired by `Marshmallow Enum <https://github.com/justanr/marshmallow_enum>`_ and by ORM libraries.
        
        The Toasted Marshmallow Enum package makes it possible to dump and load Enum values based on the ultra fast
        serialization that `Toasted Marshmallow <https://github.com/lyft/toasted-marshmallow>`_ provides.
        
        
        Installing toastedmarshmallow-enum
        ------------------------------------
        
        .. code-block:: bash
        
          pip install toastedmarshmallow-enum
        
        
        Using Toasted Marshmallow Enum
        --------------------------------
        
        Using Toasted Marshmallow Enum in an existing ``Marshmallow Schema`` is as easy as defining the enum class attribute
        as an ``EnumField``. For example:
        
        .. code-block:: python
        
            from enum import Enum
        
            import toastedmarshmallow
            from marshmallow import fields, Schema
        
            from toastedmarshmallow_enum import EnumField
        
            class Level(Enum):
                LOW = '0'
                MEDIUM = '1'
                HIGH = '2'
        
            class UserSchema(Schema):
                class Meta:
                    jit = toastedmarshmallow.Jit
        
                name = fields.String()
                level = EnumField(Level)
        
        
        How it works
        ------------
        
        ``Dump methods:``
        
        .. code-block:: python
        
            class User:
                def __init(name, level):
                    self.name = name
                    self.level = level
        
            schema = DummyUserSchema()
        
            user = User(name='John Doe', level=Level.HIGH)
            print(schema.dump(user).data)
            # {'name': 'John Doe', 'level': 2}
        
            print(schema.load({'name': 'John Doe', 'level: 2}).data)
            # {'name': 'John Doe', 'level': 'HIGH'}
        
Keywords: serialization,rest,json,api,marshal,marshalling,deserialization,validation,schema,toastedmarshmallow,enum
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
