Define models for communication between components, handling MarshallinG (m9g)
Project description
m9g : Define models for communication between components, handling MarshallinG (m9g)
Usage
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
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
tox
Run one-off test
tox -- tests/<test_file>.py::<test_name>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
m9g-0.0.6.tar.gz
(22.7 kB
view details)
Built Distribution
m9g-0.0.6-py2.py3-none-any.whl
(21.1 kB
view details)
File details
Details for the file m9g-0.0.6.tar.gz
.
File metadata
- Download URL: m9g-0.0.6.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 087b1e0f0beb12b9c514aed4d6df94cfdc1e57a5a5105d560b01455c89ed5a7d |
|
MD5 | 37e239591fea37ca997d23db61ec5988 |
|
BLAKE2b-256 | 7cef2759126e10d442a650d182190382a34a134874e453dd7cd62a3ae54e4d90 |
File details
Details for the file m9g-0.0.6-py2.py3-none-any.whl
.
File metadata
- Download URL: m9g-0.0.6-py2.py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a770eca08017adb68f913b9978dd9fd77950ab0d28f1172f244d44de46f81e32 |
|
MD5 | 6cd1b8e4f23f0a7ad02bcea3d8d6242f |
|
BLAKE2b-256 | 4e1a6d9e5c4875ad4e6141cbd7412f6eff5861e1bbba5d70bc9727ee9bd3ad29 |