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


1. Write your long running program


import oi

program = oi.Program('my program', 'ipc:///tmp/program.sock')
program.add_command('ping', lambda p: 'pong')
program.add_command('state', lambda p: p.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

$ python programd --config /etc/program.conf

$ python programctl  # enter ctl loop
programctl > ping

$ python programctl ping # OR ping end exit

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.3.2
Filename, size File type Python version Upload date Hashes
Filename, size oi-0.3.2.tar.gz (5.9 kB) File type Source Python version None Upload date Hashes View

Supported by

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