Skip to main content

A simple tmux wrapper for python

Project description

pypetmux

pypetmux is a Python wrapper around tmux, allowing you to programmatically manage sessions, windows, and panes from Python.

It provides a simple object-oriented API on top of tmux commands.


Features

  • Start and manage tmux servers
  • Create and list sessions
  • Navigate windows and panes
  • Query metadata (size, layout, etc.)
  • Thin wrapper over tmux (no magic, predictable behavior)

Installation

From PyPI

pip install pypetmux

Requirements

  • tmux must be installed and available in your PATH

Quick Example

from pypetmux import Server

server = Server()

# ensure tmux is running
if not server.is_running:
    server.start()

# create a session if it doesn't exist
if not server.has_session("work"):
    session = server.new_session("work")

# list sessions
for session in server.sessions:
    print(session.name)

How It Works

pypetmux is a thin wrapper over the tmux CLI.

Each object corresponds to a tmux concept:

Python tmux equivalent
Server tmux server
Session tmux session
Window tmux window
Pane tmux pane

The library internally runs tmux commands and parses the output.


Usage

Server

from pypetmux import Server

server = Server()

print(server.is_running)     # check if tmux is running
server.start()               # start server
server.kill()                # kill server

Sessions

session = server.new_session("demo")

print(session.name)

# rename session
session.name = "new-name"

# list windows
for window in session.windows:
    print(window.name)

# metadata
meta = session.metadata()
print(meta.width, meta.height)

Windows

window = session.windows[0]

# select window
window.select

# rename
window.name = "editor"

# navigate
next_window = window.next
prev_window = window.previous

# panes
for pane in window.panes:
    print(pane.title)

# metadata
print(window.metadata())

Notes

  • This library does not replace tmux — it wraps it
  • Errors from tmux are surfaced as Python exceptions
  • Behavior depends on your local tmux configuration

Development

  • clone the repository, cd into it
pip install maturin
maturin develop

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

pypetmux-0.1.5.tar.gz (23.7 kB view details)

Uploaded Source

Built Distributions

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

pypetmux-0.1.5-cp310-abi3-win_arm64.whl (282.0 kB view details)

Uploaded CPython 3.10+Windows ARM64

pypetmux-0.1.5-cp310-abi3-win_amd64.whl (289.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

pypetmux-0.1.5-cp310-abi3-win32.whl (272.3 kB view details)

Uploaded CPython 3.10+Windows x86

pypetmux-0.1.5-cp310-abi3-musllinux_1_2_x86_64.whl (637.6 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

pypetmux-0.1.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (480.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

pypetmux-0.1.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (425.6 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

pypetmux-0.1.5-cp310-abi3-macosx_11_0_arm64.whl (382.2 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

pypetmux-0.1.5-cp310-abi3-macosx_10_12_x86_64.whl (389.9 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file pypetmux-0.1.5.tar.gz.

File metadata

  • Download URL: pypetmux-0.1.5.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pypetmux-0.1.5.tar.gz
Algorithm Hash digest
SHA256 14ccf69b05ac60673a7e0bd1b363f0903c2fb450ac88ccdbaed026a6722a0d9e
MD5 e8ae951510928497f5cc7a4e3bd9104e
BLAKE2b-256 03513245782506c312ccb88588b70079c0606f752c0316924b04082c158c47d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5.tar.gz:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypetmux-0.1.5-cp310-abi3-win_arm64.whl.

File metadata

  • Download URL: pypetmux-0.1.5-cp310-abi3-win_arm64.whl
  • Upload date:
  • Size: 282.0 kB
  • Tags: CPython 3.10+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pypetmux-0.1.5-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 e9a3bc4a590017145b92d59f425902a3141e77d83a714c49c449cd2960cee7cd
MD5 e61a581e760a9065dfc6c0e70e328d3b
BLAKE2b-256 8c1f493f270d9d1730d7a06f585360f6f33be52c5065eb873a985215a8b48c43

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5-cp310-abi3-win_arm64.whl:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypetmux-0.1.5-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: pypetmux-0.1.5-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 289.1 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pypetmux-0.1.5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0f8be69a75326f57a768214110c4830761e03db9400af8522046242c0933844c
MD5 badb3845a3f583b5ec1fee136afc5611
BLAKE2b-256 5644bd040ee88d48201af1a079a16b7311cc4693a57af136d4674edbab38d831

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5-cp310-abi3-win_amd64.whl:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypetmux-0.1.5-cp310-abi3-win32.whl.

File metadata

  • Download URL: pypetmux-0.1.5-cp310-abi3-win32.whl
  • Upload date:
  • Size: 272.3 kB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pypetmux-0.1.5-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 57118cee5f25d0b1ff6bf960d193669fc5006e096e58835f7e32187b13ec39db
MD5 696b6a6631ca387052b1b97c93b4abf3
BLAKE2b-256 9028adb1b4f0c680ad854361549e5b2a55aab0693c108045eec316eff36bf7a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5-cp310-abi3-win32.whl:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypetmux-0.1.5-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pypetmux-0.1.5-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 872acbeba63a7087f9d19d3249a49e34739d3602f0cfbffca009985bbde4594b
MD5 d2715e9130d76dfa015fc34de14cbf69
BLAKE2b-256 e4546ca75ccc056d67c671b74095566a8c13f7be30e39823499f08ea762bdb6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypetmux-0.1.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pypetmux-0.1.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5896a3e75ee3a10dbabcc804c9aef4b5aaae4cbde4b536441e89940073bf087c
MD5 9d030e26d5ca6243410a16967330ba7b
BLAKE2b-256 4ecbe31468283f14fd9b33086599e0be892292526d0e072e3868059ff392140a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypetmux-0.1.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pypetmux-0.1.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 584cddac387d09b24e4d4537ca675120244396ccfded7a15c7b31b2b5cafe558
MD5 af813eea2156f4624745cccee59cc726
BLAKE2b-256 3b510f6f5f69cd668a3d6a808a86dccceb1e8940ae194ef0556f76a8f421d067

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypetmux-0.1.5-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypetmux-0.1.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f076df8ca44c2591f9895a0a7b44c28e5810b6fc1679a95487f637171871c38
MD5 c3a0f8a13eba219fc65fc07fd20a4d53
BLAKE2b-256 f0b6ef00f9ac1239491b075cbc5f43803397225293a026f7a64b1680037fd601

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypetmux-0.1.5-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pypetmux-0.1.5-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 11541ab96c7c5eecc9d963f3f78743c2c779bd289110f199e4a9726b896d6ad7
MD5 2be9d474626fea6caff65960ad603eb0
BLAKE2b-256 36e765c021da0dd0675df8c9fffc8afa0763d9171055b5b0cf1a393ef0dfe8c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypetmux-0.1.5-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: CI.yml on rotleaf/pypetmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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