Skip to main content

Declarative tmux session manager — config lives in your repo.

Project description

tmuxr

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

pip install tmuxr

To install from source:

git clone https://github.com/DVamsee/cliin.git
cd cliin
pip install -e .

To install with test dependencies:

pip install -e ".[test]"

Quick Start

1. Create a tmuxfile.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

tmuxr up

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

3. Other commands

tmuxr down        # kill the session
tmuxr status      # list running tmuxr sessions
tmuxr up -d       # start without attaching (detached mode)
tmuxr 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 tmuxr up from any subdirectory — tmuxr walks up the directory tree to find tmuxfile.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 tmuxfile.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 TMUXR_MANAGED=1 on the tmux session so tmuxr status only shows tmuxr-managed sessions

For more details, see docs/ARCHITECTURE.md.

Running Tests

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.1.1.tar.gz (14.7 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.1.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tmuxr-1.1.1.tar.gz
Algorithm Hash digest
SHA256 57f64aa198c878f84ec70214f16232ee9f53c8337e2a768ee929d66ea06fc245
MD5 df5f7c69480a155175d0268c064c732b
BLAKE2b-256 da0b0d5c0658a6d2c769d8995dbc037ea44cdccebb6c525e53053250e6109c96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tmuxr-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 257941294492250557b6fc0aec2705dca901a154d1e9525e25b4915cd2241857
MD5 9b2c4d52fa8624a1e3120cf889f0248f
BLAKE2b-256 8318b969fe1e21439a53c11f6708252ea3c81f259b46d5e2647e4d8ed4a88430

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