Skip to main content

oi

python library for writing long running processes with a cli interface

Build Status

oi image

oi image

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 p: 'pong')
program.add_command('state', lambda p: p.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

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

$ python programctl  # enter ctl loop
programctl > ping
pong

$ 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
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

Metadata

Release files for oi 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oi 0.3.2
File Size Uploaded Provenance
oi-0.3.2.tar.gz 5.9 kB Without provenance Details

Release files / oi-0.3.2.tar.gz

Download URL oi-0.3.2.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e8bc223cc39e8655ac68a9f649a173801b53c68c783a724943f12daed11bec7b
BLAKE2b-256 checksum
How to use checksums
1a06a5dcf00a234680fbcfe379382c8617f849ed4743a5a632d2cc2602a2ec55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for oi 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page