Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kanzure/modelo
absurdly simple models for python
https://github.com/kanzure/modelo
Last synced: 3 months ago
JSON representation
absurdly simple models for python
- Host: GitHub
- URL: https://github.com/kanzure/modelo
- Owner: kanzure
- License: other
- Created: 2014-06-28T00:16:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-06T19:02:41.000Z (over 10 years ago)
- Last Synced: 2024-09-12T22:35:57.266Z (4 months ago)
- Language: Python
- Size: 254 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**Modelo** is a pure python library for making models:
``` python
from modelo import (
Model,
field,
)class User(Model):
name = field.String()
email_address = field.String()
registration_number = field.Integer()user = User.create({
"name": "John Testington",
"email_address": "[email protected]",
"registration_number": 5,
})print user.to_dict()
```# API
## Model.create
Create a new instance of the model.
``` python
some_model = Model.create({
"key": "value",
})
```## Model.to_dict
Dump model values to a dictionary.
``` python
data = some_model.to_dict()
```# future directions
* translators:
* * [sqlalchemy](http://sqlalchemy.org/) model translator: convert modelo models into sqlalchemy table data or declarative model classes
* * [RAML](http://raml.org/) translator
* * json-schema
* * protobufs# license
BSD
# origins
Modelo is shamelessly based on [hipster](https://github.com/d3vz3r0/hipster), [traitlets](https://github.com/ipython/traitlets) and [traits](https://github.com/enthought/traits).