Flowdas: The OpenRPC Framework


License
MPL-2.0
Install
pip install flowdas==0.5.0

Documentation

flowdas

flowdas requires Python 3.4+.

flowdas.command

This package provides a simple way of defining command-line interface.

Example

# sample.py
from flowdas.command import Command


class SampleCommand(Command):
    """flowdas.command demo"""

    def sum(self, *number: int):
        """calculate the sum of integers"""
        print(sum(number))


if __name__ == '__main__':
    SampleCommand.main()
$ pip install flowdas
$ python sample.py sum 1 2 3
6

$ python sample.py
usage: sample.py [-h] {sum} ...

$ python sample.py -h
usage: sample.py [-h] {sum} ...

flowdas.command demo

optional arguments:
  -h, --help  show this help message and exit

subcommands:
  {sum}
    sum       calculate the sum of integers

flowdas.meta

A platform-agnostic library for schema modeling

Example

>>> from flowdas import meta
>>> from pprint import pprint
...
>>> class Author(meta.Entity):
...    name = meta.String()
...
>>> class Book(meta.Entity):
...    title = meta.String()
...    published = meta.Date()
...    authors = Author[1:]()
...
>>> author1 = Author({'name': 'O'})
>>> author2 = Author()
>>> author2.update(name = 'Flowdas')
>>> book = Book()
>>> book.title = 'Meta'
>>> book.published = '2016-03-15'
>>> book.authors = [author1, author2]
>>> book.published
datetime.date(2016, 3, 15)
>>> book.validate()
>>> pprint(book.dump())
{'authors': [{'name': 'O'}, {'name': 'Flowdas'}],
 'published': '2016-03-15',
 'title': 'Meta'}