Overview

docs
Documentation Status
tests
Travis-CI Build Status
Requirements Status
package
license PyPI Package latest release PyPI Wheel
Supported versions Supported implementations
Commits since latest release

Zentropi: Script Your World.

Zentropi is for you if:

  • You like the idea of making your own bots.
  • You want to build your personal internet-of-things.
  • You are curious about automation at work and/or home.
  • You care about your time; automation lets you do more of things you enjoy.
  • You consider building your own tools to tackle the increasing complexity of your responsibilities.
  • You imagine a world where your real and virtual worlds can interact with each other seamlessly.
  • You dream of raising your own army of minions... doing your work tirelessly while you take a vaca...

..where were we? Ah, yes, if any of these ^^ sound familiar, you are not alone!

Installation

Note: Requires Python 3.5+ and compiler toolchain to build c-extensions.

Stable:

$ python3 -m venv zen
$ source zen/bin/activate
$ pip install zentropi

Current:

$ python3 -m venv zen
$ source zen/bin/activate
$ git clone https://github.com/zentropi/python-zentropi.git
$ cd python-zentropi
$ pip install -e .

Install steps for Ubuntu and MacOS: https://zentropi.readthedocs.io/en/latest/installation.html

Example

We will make a toy agent that responds to the message “hello” with a “hello, world”.

https://cloud.githubusercontent.com/assets/23116/25562708/1d83f7b4-2dab-11e7-988a-bccb2862b656.png

The above illustration shows how the concepts and objects are logically arranged and connected within Zentropi. We will go deeper into these in the READMEs along with examples, for now let us jump straight to the code:

from zentropi import Agent, on_message, run_agents, ZentropiShell


class HelloBot(Agent):
    @on_message('hello')
    def say_hello(self, message):
        return 'hello, world'


if __name__ == '__main__':
    hello_bot = HelloBot(name='hello_bot')
    shell = ZentropiShell(name='shell')
    run_agents(hello_bot, shell)

Save this as hello.py and run with $ python hello.py

You should see this on your screen:

$ python hello.py
⚡ ︎ @shell: '*** started'
⚡ ︎ @shell: 'shell-starting'
⚡ ︎ @shell: 'shell-ready'
〉

We can type any message at the prompt and the shell agent will broadcast it for us. Go ahead and type hello, followed by ENTER.

〉hello
✉  @shell: 'hello'
✉  @hello_bot: 'hello, world' {'text': 'hello, world'}
⚡ ︎ @shell: 'shell-ready'
〉exit

Type exit or press Ctrl-D to leave the shell.

What next?

Zentropi is still being developed and is not production-ready, however it is already useful to experiment and build toys.

Check out what is already possible in the examples directory:

https://github.com/zentropi/python-zentropi/tree/master/examples