Metadata-Version: 2.1
Name: py-serializer
Version: 0.9.5
Summary: Package for serializing python object & dataclasses
Home-page: UNKNOWN
Author: Hamilakis Nicolas
Author-email: nick.hamilakis562@gmail.com
License: UNKNOWN
Description: ## Serializer
        
        A serialization module for python objects
        
        ## Quickstart
        
        > `pip install .....`
        
        
        ```python
        from typing import List
        from serializer import serializable
        
        @serializable
        class Role:
            role_type: str
            attributes: List[str]
        
        @serializable
        class Person:
            name: str
            age: int
            height: float
            weight: float
            address: str
            role: List[Role]
        
        
        p = Person(
            name="Paul", age=25, height=1.70, weight=83.5, address="earth",
            role=[Role(role_type='human', attributes=['speak', 'eat', 'sleep'])]
        )
        
        print(p.to_dict())
        ```
        
        > ```
        > {
        >     'name': 'Paul', 
        >     'age': 25, 
        >     'height': 1.7,
        >     'weight': 83.5, 
        >     'address': 'earth', 
        >     'role': [
        >           {
        >             'role_type': 'human',
        >             'attributes': ['speak', 'eat', 'sleep']
        >           }
        >     ]
        > }
        >```
        
        
        **Serializable wrapper extends *dataclass* so you can treat it like a normal dataclass.**
        
        
        ## Mixin
        
        It is possible to have a class extend abstract class SerializableMixin
        
        ```python
        from serializer import SerializableMixin, serializer
        
        class Test(SerializableMixin):
            
            def __init__(self, name: str):
                self.name = name
        
            def __serialize__(self):
                return dict(name=serializer(self.name))
        ```
        
        > `>> Test(name='Paul').to_dict()`
        
        > `{ 'name': 'Paul' } `
        
        For object to be seriazable they only need to implement a `__serialize__` method.
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Typing :: Typed
Description-Content-Type: text/markdown
