Skip to main content

Pure Python terminal multiplexer.

Project description

A terminal multiplexer (like tmux) in Python

pip install pymux
https://raw.githubusercontent.com/jonathanslenders/pymux/master/images/pymux.png

Issues, questions, wishes, comments, feedback, remarks? Please create a GitHub issue, I appreciate it.

Installation

Simply install pymux using pip:

pip install pymux

Start it by typing pymux.

What does it do?

A terminal multiplexer makes it possible to run multiple applications in the same terminal. It does this by emulating a vt100 terminal for each application. There are serveral programs doing this. The most famous are GNU Screen and tmux.

Pymux is written entirely in Python. It doesn’t need any C extension. It runs on all Python versions from 2.6 until 3.5. It should work on OS X and Linux.

Compared to tmux

To some extent, pymux is a clone of tmux. This means that all the default shortcuts are the same; the commands are the same or very similar, and even a simple configuration file could be the same. (There are some small incompatibilities.) However, we definitely don’t intend to create a fully compatible clone. Right now, only a subset of the command options that tmux provides are supported.

Pymux implements a few improvements over tmux:

  • There is a completion menu for the command line. (At the bottom of the screen.)

  • The command line has fish-style suggestions.

  • Both Emacs and Vi key bindings for the command line and copy buffer are well developed, thanks to all the effort we have put earlier in prompt_toolkit.

  • Search in the copy buffer is highlighted while searching.

  • Every pane has its own titlebar.

  • When several clients are attached to the same session, each client can watch a different window. When clients are watching different windows, every client uses the full terminal size.

  • Support for 24bit true color. (Disabled by default: not all terminals support it. Use the --truecolor option at startup or during attach in order to enable it.)

  • Support for unicode input and output. Pymux correctly understands utf-8 encoded double width characters. (Also for the titlebars.)

About the performance:

  • Tmux is written in C, which is obviously faster than Python. This is noticeable when applications generate a lot of output. Where tmux is able to give fast real-time output for, for instance find / or yes, pymux will process the output slightly slower, and in this case render the output only a few times per second to the terminal. Usually, this should not be an issue. If it is, Pypy should provide a significant speedup.

The big advantage of using Python and prompt_toolkit is that the implementation of new features becomes very easy.

More screenshots

24 bit color support and the autocompletion menu:

https://raw.githubusercontent.com/jonathanslenders/pymux/master/images/menu-true-color.png

What happens if another client with a smaller screen size attaches:

https://raw.githubusercontent.com/jonathanslenders/pymux/master/images/multiple-clients.png

When a pane enters copy mode, search results are highlighted:

https://raw.githubusercontent.com/jonathanslenders/pymux/master/images/copy-mode.png

Why create a tmux clone?

For several reasons. Having a terminal multiplexer in Python makes it easy to experiment and implement new features. While C is a good language, it’s not as easy to develop as Python.

Just like pyvim (A Vi clone in Python.), it started as another experiment. A project to challenge the design of prompt_toolkit. At this point, however, pymux should be stable and usable for daily work.

The development resulted in many improvements in prompt_toolkit, especially performance improvements, but also some functionality improvements.

Further, the development is especially interesting, because it touches so many different areas that are unknown to most Python developers. It also proves that Python is a good tool to create terminal applications.

The roadmap

There is no official roadmap, the code is mostly written for the fun and of course, time is limited, but I use pymux professionally and I’m eager to implement new ideas.

Some ideas:

  • Support for color schemes.

  • Support for extensions written in Python.

  • Better support for scripting. (Right now, it’s already possible to run pymux commands from inside the shell of a pane. E.g. pymux split-window. However, status codes and feedback aren’t transferred yet.)

  • Improved mouse support. (Reporting of mouse movement.)

  • Parts of pymux could become a library, so that any prompt_toolkit application can embed a vt100 terminal. (Imagine a terminal emulator embedded in pyvim.)

  • Maybe some cool widgets to traverse the windows and panes.

  • Better autocompletion.

Configuring

Create a file ~/.pymux.conf, and populate it with commands, like you can enter at the command line. There is an example config in the examples directory.

What if it crashes?

If for some reason pymux crashes, it will attempt to write a stack trace to a file with a name like /tmp/pymux.crash-*. It is possible that the user interface freezes. Please create a GitHub issue with this stack trace.

Special thanks

  • Pyte, for providing a working vt100 parser. (This one is extended in order to support some xterm extensions.)

  • docopt, for parsing the command line arguments.

  • prompt_toolkit, for the UI toolkit.

  • wcwidth: for better unicode support (support of double width characters).

  • tmux, for the inspiration.

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

pymux-0.14.tar.gz (67.5 kB view details)

Uploaded Source

Built Distributions

pymux-0.14-py3-none-any.whl (78.9 kB view details)

Uploaded Python 3

pymux-0.14-py2-none-any.whl (78.9 kB view details)

Uploaded Python 2

File details

Details for the file pymux-0.14.tar.gz.

File metadata

  • Download URL: pymux-0.14.tar.gz
  • Upload date:
  • Size: 67.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymux-0.14.tar.gz
Algorithm Hash digest
SHA256 997ea21c5cc0dcd86271b2cc10875a808adf6f1ebd035bb810bc6bca9c1ae58c
MD5 e82f13c59f3e1189c8c624e269dd1ef0
BLAKE2b-256 273c8b1a9c7e765a72a0c0fbb21c606dddea84d704d4fa1d4a68ef953ba85196

See more details on using hashes here.

File details

Details for the file pymux-0.14-py3-none-any.whl.

File metadata

  • Download URL: pymux-0.14-py3-none-any.whl
  • Upload date:
  • Size: 78.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymux-0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 a9246229716e4b3705b112813ae8e2f8c1718d8f9dc64528f9d1fe90d8d255a7
MD5 58643cc5fd8dacfef570a75d2e38f6ef
BLAKE2b-256 a84ac9ef8349a3c9d3544ce61314c7ae8561efd233dd429191cb696c4808b5c4

See more details on using hashes here.

File details

Details for the file pymux-0.14-py2-none-any.whl.

File metadata

  • Download URL: pymux-0.14-py2-none-any.whl
  • Upload date:
  • Size: 78.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymux-0.14-py2-none-any.whl
Algorithm Hash digest
SHA256 796d1203ae8edd0b3e9ddbb1b0aa24475e1d16649d8a372e7a83166aa139ebdc
MD5 4286a0124e521a66b9ebb4346028a63a
BLAKE2b-256 2a792f5e72ecd8ea283a3096f551e10911a7c3c4704d8fdfdbb53456022c2cda

See more details on using hashes here.

Supported by

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