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.

Source Distribution

oi-0.4.2.tar.gz (8.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page