Oi
python library for writing long running processes with a cli interface
Install / Use
/learn @walkr/OiREADME
oi
python library for writing long running processes with a cli interface

Install
Note: You need nanomsg installed on your system:
$ git clone git@github.com:nanomsg/nanomsg.git
$ cd nanomsg
$ ./configure
$ make
$ make check
$ sudo make install
Then install oi
$ pip install oi
Usage
####1. Write your long running program
# programd.py
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.run() # program will run forever
####2. Add a ctl interface
# programctl.py
import oi
ctl = oi.CtlProgram('ctl program', address='ipc:///tmp/program.sock')
ctl.run()
####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
pong
# 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
pong
# Upload to pypi (Edit setup.py 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://192.168.1.100:5000 in both your programd.py and programctl.py. That's it! (:
TODO
- [ ] Add more testing
License
MIT License
Related Skills
qqbot-channel
351.2kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
claude-opus-4-5-migration
110.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
docs-writer
100.5k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
351.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
