Metadata-Version: 2.1
Name: m9g
Version: 0.0.6
Summary: Define models for communication between components, handling MarshallinG (m9g)
Home-page: https://github.com/radiocutfm/m9g
Author: Lambda Sistemas
Author-email: desarrollo@lambdasistemas.com.ar
License: UNKNOWN
Project-URL: Bug Reports, https://github.com/radiocutfm/m9g/issues
Project-URL: Funding, https://donate.pypi.org
Project-URL: Say Thanks!, https://saythanks.io/to/guillermo.narvaja%40radiocut.fm
Project-URL: Source, https://github.com/radiocutfm/m9g/
Keywords: marshalling serialize communication model
Platform: UNKNOWN
Classifier: Topic :: Software Development :: Object Brokering
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4
Description-Content-Type: text/markdown
Requires-Dist: future
Requires-Dist: future-fstrings
Provides-Extra: dev
Requires-Dist: check-manifest ; extra == 'dev'
Provides-Extra: test
Requires-Dist: coverage ; extra == 'test'

![Build Status](https://github.com/radiocutfm/m9g/workflows/Run%20tests/badge.svg)

## m9g : Define models for communication between components, handling MarshallinG (m9g)

### Usage


```python
import m9g
class Book(m9g.Model):
    id = m9g.IntField(pk=True)
    author = m9g.StringField()

book = Book(id=1, author="Hemingway")
book.serialize()  # JSON as default
'{"id": 1, "author": "Hemingway"}'
```


#### Complex types

```python
import datetime

class Author(m9g.Model):
    id = m9g.IntField(pk=True)
    authored_books = m9g.ListField(
            m9g.StringField()
    )
    birth_date = m9g.DateField()

author = Author(
    id=1,
    authored_books=[
            "The Torrents of Spring",
            "The Sun Also Raises",
            "A Farewell To Arms"
    ],
    birth_date = datetime.date(
            year=1899,
            month=7,
            day=21
    )
)
author.serialize()
'{"id": 1, "authored_books": ["The Torrents of Spring", "The Sun Also Raises", "A Farewell To Arms"], "birth_date": "1899-07-21"}'

```


## Contributing

### Run tests for python 2.7 / 3.6

```shell
    tox
```

### Run one-off test

```shell
    tox -- tests/<test_file>.py::<test_name>
```


