Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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).