Skip to main content

Oxen

Oxen is a lightweight Python library for managing multiple tasks.

  • Run subprocesses and custom async work as observable tasks
  • Stream their output into a terminal-based UI
  • Use keyboard shortcuts to quickly manage task lifecycles (run/stop/restart)
  • Easily define split views to create custom task dashboards
from oxen import Oxen, Shell

Oxen(
    Shell('python -m http.server', name='server'),
    Shell('tsc --watch', name='compile'),
).run()

Install

Oxen requires Python 3.12 or newer.

pip install oxen

Quickstart

The Oxen class manages a collection of arbitrary Task instances. You can either pass tasks during construction:

ox = Oxen(
    Shell('python -m http.server', name='server'),
    Shell('ping google.com', name='ping'),
)

Or add them after construction:

ping = Shell('ping google.com')
ox.add(ping)

By default, eligible tasks are automatically started and displayed in a text-based UI when the run method is called:

# Displays TUI and runs all eligible tasks.
ox.run()

Tasks

A Task represents asynchronous work and reports its status and output.

You can either subclass Task to provide your own custom logic, or use one of the built-in utility subclasses described below.

Subprocesses

Use Process or Shell for subprocess tasks.

from oxen import Oxen, Process

tests = Process('python', '-m', 'unittest', 'discover', name='tests')
Oxen(tests).run()

Shell is essentially a shorthand for Process(..., shell=True). Use it when you want pipes, redirects, variables, or other shell syntax:

from oxen import Oxen, Shell

monitor = Shell(
    'tail -f console.log | grep -i error',
    pty=True,
    name='logs',
)
Oxen(monitor).run()
  • By default, both stdout and stderr are captured.
  • Oxen correctly renders common interactive output, such as progress bars, by interpreting cursor, erase, color, and carriage-return sequences.
  • Pseudoterminal (PTY) mode can be enabled on POSIX platforms by passing pty=True.

Watching the Filesystem

Use Watch to auto-run a task whenever one or more files or directories change:

from oxen import Oxen, Shell
from oxen.watch import Watch

watch_tests = Watch(
    # Watch the src and test directories for changes
    'src',
    'tests',
    # Run unit tests whenever changes are detected
    task=Shell('python -m unittest discover', name='tests'),
)
Oxen(watch_tests).run()

Watch requires the Watchdog library for filesystem events monitoring. Install it with:

pip install 'oxen[watch]'

Custom Tasks

Subclass Task to put any asynchronous work behind the same status, output, and lifecycle interface:

from oxen import Task

class MyTask(Task):

    async def execute(self) -> bool:
        self.output.append('Working...\n')

        # ... do asynchronous work here ...

        return True

See custom_task.py for a simple example.

Dashboards

The default task browser shows the selected task’s output. Split views can display several tasks simultaneously:

ox.add_layout(
    [
        (frontend, backend),  # tuple: stacked horizontally
        tests,
    ],  # list: stacked vertically
    name='Development',
    default=True,  # Show this by default instead of the task browser
    shortcut='d',  # Keyboard shortcut for this layout
)

Lists stack items vertically while tuples arrange them horizontally. These can be arbitrarily nested. Tasks found in a layout are registered automatically, and focusing a panel selects its task for lifecycle actions.

See dashboard.py for a simple example.

License

Oxen is available under the 3-Clause BSD License.

Metadata

Release files for oxen 2.0.0

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

Built distribution (wheel)

Table of built distributions (wheels) for oxen 2.0.0
File Interpreter ABI Platform
oxen-2.0.0-py3-none-any.whl Python 3 none any Details

Release files / oxen-2.0.0-py3-none-any.whl

Download URL oxen-2.0.0-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a8c98b43aeb64c3e18d98d734de92a88cdfbc83e6ed5caf99813546f447aad1
BLAKE2b-256 checksum
How to use checksums
0b57f01cc46ed6eabb00184e6e712f6fde18e038fc45c1d7405cdc3295ed2541
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Security for oxen 2.0.0

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.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for oxen-2.0.0-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

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