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-cli.git
    cd orch-cli
    
  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.1.tar.gz (20.4 kB 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.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: orch_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • 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.1.tar.gz
Algorithm Hash digest
SHA256 ce56bb4e3ddb7d141c6f18baa5a5bb658535c02b2d3be9010dd20ef5da1d72ea
MD5 4ff4cbce527867ae2e418f7bd245c9e3
BLAKE2b-256 6ad99764228199d5796e732bd5ea5f3581c5820fa2db1a06316bb343f1c1181c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: orch_cli-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 606f574136de02a76920d802c0cb14187cb03feef01c69cb506e05f3564b5ecb
MD5 e113e749d63dd13f25a913a5a030a309
BLAKE2b-256 3403ba6b0bb684c10bdf72ad563ca9bccd6f938c27d40eb524dd1c034db10a1f

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