Skip to main content

A library for writing long running processes with a cli interface

Project description

python library for writing long running processes with a cli interface

Build Status

oi image

oi image


Note: You need nanomsg installed on your system:

$ git clone
$ cd nanomsg
$ ./configure
$ make
$ make check
$ sudo make install

Then install oi

$ pip install oi


1. Write your long running program


import oi

program = oi.Program('my program', 'ipc:///tmp/program.sock')
program.add_command('ping', lambda: 'pong')
program.add_command('state', lambda: program.state)  # program will run forever

2. Add a ctl interface


import oi

ctl = oi.CtlProgram('ctl program', address='ipc:///tmp/program.sock')

3. Run program, then connect to it via ctl

# Run process
$ python programd

# OR with a configuration file
$ python programd --config /etc/program.conf

$ python programctl  # enter ctl loop
programctl > ping

# OR ping end exit
$ python programctl ping

Quickly get started with a new project

$ mkdir xprogram
$ cd xprogram

$ oi init
$ make install

# Start your program
$ xprogramd

# Start ctl program
$ xprogramctl
ctl > ping

# Upload to pypi (Edit before distributing)
$ make distribute

Now the interesting bit. Are you ready?

Run your program on one computer, then control it from another with a single line change (actually two).

Just change the address ipc:///tmp/program.sock to a tcp address, such as tcp:// in both your and That’s it! (:


  • [ ] Add more testing


MIT License

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for oi, version 0.4.2
Filename, size File type Python version Upload date Hashes
Filename, size oi-0.4.2.tar.gz (8.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page