Skip to main content

A local development process orchestrator and venv-aware runner

Project description

Orch - Local Service Orchestrator

PyPI version License: MIT Build Status

Orch is a lightweight, daemon-less command-line interface (CLI) tool designed to simplify local development of client-server or multi-service architectures.

It runs your scripts, servers, frontends, and workers concurrently, manages their Python virtual environments (venv) transparently, monitors their resources, and multiplexes their logsโ€”without the overhead of Docker or background daemon processes.


Key Features

  • ๐Ÿ”Œ Daemon-less Architecture: No persistent background services needed. State is safely tracked locally in .orch/state.json.
  • ๐Ÿ Automatic venv Detection: Injects your project's Python virtual environment (venv) to the process execution path automaticallyโ€”no manual activation scripts required.
  • ๐ŸŽจ Unified Multiplexed Logs: Streams output from all services into a single terminal window with distinct, customizable color prefixes, protecting ANSI markup.
  • ๐ŸŒ™ Background Execution: Spawn services in detached modes, persisting output to individual log files.
  • ๐Ÿ“Š Resource Monitoring: Track CPU, Memory consumption, and uptime per service with a single command.
  • ๐Ÿ›ก๏ธ Clean Process Tree Teardown: Intercepts shutdown signals and recursively kills child processes (e.g. Node sub-processes, shell scripts) cleanly, avoiding orphaned processes.
  • ๐Ÿ›ก๏ธ PID Recycle Protection: Safeguards against re-using recycled PIDs by validating the OS process creation time before killing or reporting status.

Installation

Stable Release (via PyPI)

pip install orch-cli

From Source (Development Mode)

  1. Clone the repository:

    git clone https://github.com/EASYLIFECODE/orch.git
    cd orch
    
  2. Install in editable development mode:

    pip install -e .
    

Configuration (orch.yml)

Configure your services in an orch.yml or project.yml file in the root of your project:

# orch.yml
project: my-awesome-app

# Global environment configuration
env:
  type: venv               # Type of virtual environment
  path: ./venv            # Path to the virtualenv folder
  variables:
    GLOBAL_VAR: "shared-value"
    DATABASE_URL: "sqlite:///local.db"

services:
  backend:
    path: ./backend        # Working directory for this service
    command: python app.py  # Automatically runs using the configured global venv
    env:
      PORT: "8000"

  frontend:
    path: ./frontend
    command: npm run dev
    env:
      VITE_API_URL: "http://localhost:8000"

  worker:
    path: ./worker
    command: python worker.py

CLI Usage

1. Run in Foreground (Interactive Mode)

Launches all services concurrently, streaming their colored logs into the active console. Pressing Ctrl+C cleanly shuts down all services.

orch up

2. Run in Background (Detached Mode)

Launches all services in the background and saves their state.

orch start

3. Check Service Status & Resource Usage

Displays an elegant table showing running status, PID, CPU, Memory usage (recursive of all child processes), and uptime.

orch status

Example Output:

           Project: my-awesome-app (Services Status)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Service  โ”‚ Status  โ”‚  PID  โ”‚ CPU % โ”‚ Memory (MB) โ”‚  Uptime  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ backend  โ”‚ RUNNING โ”‚ 12452 โ”‚  0.2% โ”‚     45.4 MB โ”‚ 00:12:30 โ”‚
โ”‚ frontend โ”‚ RUNNING โ”‚ 12459 โ”‚  0.0% โ”‚     82.1 MB โ”‚ 00:12:30 โ”‚
โ”‚ worker   โ”‚ RUNNING โ”‚ 12461 โ”‚  1.5% โ”‚     32.7 MB โ”‚ 00:12:28 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4. Consult and Tail Logs

Tail log files of services running in the background.

# Follow logs of all services
orch logs -f

# Follow logs of a specific service
orch logs backend -f

# Read last 100 lines without following
orch logs frontend --lines 100

5. Restart Services

Restarts all or specific services running in the background.

# Restart all
orch restart

# Restart only backend
orch restart backend

6. Stop Services

Stops services running in the background and cleans up state.

# Stop all services
orch stop

# Stop a specific service
orch stop backend

7. Clean State & Logs

Terminates background services, clears log files (.orch/logs/*.log) to 0 bytes, and resets the state file.

orch clean

Technical Architecture

Orch is built using Python 3.8+, Typer for the CLI framework, Rich for visual output rendering, and psutil for platform-independent process controls.

                     [ CLI Command: orch ]
                              โ”‚
                    [ Load Configuration ]
                              โ”‚
                    [ Validate YAML Schema ]
                              โ”‚
                    [ Process Execution ]
                              โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  [ Foreground Mode ]                       [ Background Mode ]
  (Multiplex to Terminal)                   (Write to Log Files)
         โ”‚                                         โ”‚
  โ”œโ”€โ”€ Thread 1 (stdout)                     โ”œโ”€โ”€ .orch/logs/backend.log
  โ”œโ”€โ”€ Thread 2 (stdout)                     โ”œโ”€โ”€ .orch/logs/frontend.log
  โ””โ”€โ”€ SIGINT cleanup                        โ””โ”€โ”€ Keep PIDs in .orch/state.json

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

orch_cli-0.1.0.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orch_cli-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file orch_cli-0.1.0.tar.gz.

File metadata

  • Download URL: orch_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.12.9"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.15 3 Sep 2024","python":"3.12.9","system":{"name":"Windows","release":"11"}} HTTPX2/2.4.0

File hashes

Hashes for orch_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 251214bba83865a4d14b0077e820b56e42e847c28e7ccf45cbcc1f1d9119d38f
MD5 c5479defe285a729da303cf50eb5445e
BLAKE2b-256 f585f94bbd39e37323cdc5f066a07cd74fbe6edba34b98c6dafe13e4753aa780

See more details on using hashes here.

File details

Details for the file orch_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: orch_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.12.9"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.15 3 Sep 2024","python":"3.12.9","system":{"name":"Windows","release":"11"}} HTTPX2/2.4.0

File hashes

Hashes for orch_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d08f85441f0effc37a327599d88d46c9d34a94276a4e5c76ba983bd0924ec7f4
MD5 a0a73fcdf36b35762bb731115ada0c54
BLAKE2b-256 a79b2d1857c079f1b47d28969b96765dfcf0623ae2e1cf24490b3106229c9002

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page