Skip to main content

Declarative tmux session manager — config lives in your repo.

Project description

cliin

Declarative tmux session manager. Config lives in your repo.

Prerequisites

  • Python >= 3.11
  • tmux installed and available in PATH
# macOS
brew install tmux

# Ubuntu / Debian
sudo apt install tmux

Install

# Clone the repo
git clone <repo-url>
cd cliin

# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install cliin
pip install -e .

# Verify
cliin --version

To install with test dependencies:

pip install -e ".[test]"

Note: Always activate the virtual environment (source .venv/bin/activate) before using cliin.

Quick Start

1. Create a .cliin.yml in your project root

session: my-app

windows:
  - name: backend
    dir: ./backend
    cmd: npm run dev

  - name: frontend
    dir: ./frontend
    cmd: npm run dev

  - name: worker
    cmd: python worker.py

2. Start the session

cliin up

That's it. cliin creates a tmux session with three windows, each running its command in the right directory.

3. Other commands

cliin down        # kill the session
cliin status      # list running cliin sessions
cliin up -d       # start without attaching (detached mode)
cliin up -f custom.yml  # use a different config file

Config Reference

Top-level fields

Field Type Default Description
session string required tmux session name
env_file string null Global .env file, sourced in every window
windows list required List of window definitions

Window fields

Field Type Default Description
name string required Window name in tmux
cmd string required Command to run
dir string . Working directory (relative to config file)
restart string never never / on-failure / always
env_file string null Per-window .env file
pre_cmd string null Command to run before main cmd

Path resolution

All paths (dir, env_file) are resolved relative to the config file's location, not cwd. You can run cliin up from any subdirectory — cliin walks up the directory tree to find .cliin.yml, just like git finds .git/.

Examples

Web app with auto-restart

session: webapp

windows:
  - name: server
    cmd: python manage.py runserver
    restart: on-failure

  - name: worker
    cmd: celery -A app worker
    restart: always

  - name: shell
    cmd: bash

Monorepo with env files

session: platform

env_file: .env.shared

windows:
  - name: api
    dir: ./services/api
    cmd: go run .
    env_file: ./services/api/.env
    restart: on-failure

  - name: web
    dir: ./apps/web
    cmd: npm run dev

  - name: db
    dir: ./infra
    pre_cmd: docker-compose up -d postgres
    cmd: pgcli -d myapp

Python project with virtualenv

session: ml-pipeline

windows:
  - name: train
    cmd: python train.py
    pre_cmd: source .venv/bin/activate
    restart: on-failure

  - name: tensorboard
    cmd: tensorboard --logdir runs/
    pre_cmd: source .venv/bin/activate

  - name: jupyter
    cmd: jupyter lab --port 8888
    pre_cmd: source .venv/bin/activate

How It Works

  1. Config parsing — reads .cliin.yml, validates fields, resolves relative paths to absolute
  2. Session creation — creates a tmux session via libtmux, one window per entry
  3. Window setup — for each window: cd to dir, source env files (global then per-window), run pre_cmd, run cmd
  4. Process watching — starts background threads for windows with restart policy. Polls every 3s; if a process exits (pane falls back to shell), re-runs the setup sequence
  5. Session tagging — sets CLIIN_MANAGED=1 on the tmux session so cliin status only shows cliin-managed sessions

For more details, see docs/ARCHITECTURE.md.

Running Tests

source .venv/bin/activate
pip install -e ".[test]"
pytest tests/ -v

License

MIT

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

tmuxr-1.0.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

tmuxr-1.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file tmuxr-1.0.0.tar.gz.

File metadata

  • Download URL: tmuxr-1.0.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for tmuxr-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6ca2b373c699d08a526a49928571792ff0dccb7a50cd0d891ecbed34753266cc
MD5 094ca76e8e054040fa59d22f128fd5be
BLAKE2b-256 f2eade05573c5ac7bd56187f8eddf1f7a53326f745905f372ab6666666c80a93

See more details on using hashes here.

File details

Details for the file tmuxr-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tmuxr-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for tmuxr-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 370b4967f7bc04bc55840bad84db3faa4831edcaa5c9f6fcfeca727dad63b1ca
MD5 48a3a782bd2f2a2830e59388f4437e5e
BLAKE2b-256 874e6f77f625b1065f5d716305e48be83d969c08a24162d2ea897ed124bf8e61

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