To some extend, 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.)
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.
That doesn't answer the question though. Why not just add all (or some) of the aforementioned stuff to tmux? Tmux is an established, widely used piece of software. Any improvements would be much more appreciated there.
You could say the same about screen vs tmux (or endless other software clones). Projects like these help drive innovation on both sides. Competition, if you like.
Besides, Pymux is Python while tmux is C. I'm sure you can appreciate that adding a Python API to tmux would be non-trivial, both code-wise and politically.
Not everything has to innovate. I understand it would be more useful to you and I if it did innovate, but there isn't some prereq for posting to hacker news that your project has to be innovative.
I personally find this project interesting to see, although I won't be using it.
you seem to have confused innovation with invention. but that's beside the point. you seem to think that software needs to be either to deserve existance. looks like you're in the minority with that opinion, the rest of us is quite happy with iterative, gradual improvement. we consider it better than sticking with whatever the first shot at an implementation managed to hit.
As for pymux, Jonathan Slenders' work on ptpython [1] and prompt_toolkit have been quite nice when working with shell_plus in django or debugging python projects. He's good in this area. Agreed that it's a nice thing to have pymux there.
And agreed that adding native language extensions (python, ruby, etc.) to tmux would be complicated code-wise and perhaps not in the spirit of what it aspires to be. That said, on the tmuxp side of things, a lot could be improved. For example, switching tmuxp to use control mode (-C) and filing smaller patches to expand control mode's events in tmux(1).
I think he means the exact same Python script can be run directly on any environment that has Python installed if written correctly, in contrast to a C program which has to be recompiled on various environments to be able to run.
Python as a language is implemented on almost every platform out there- You can just take this source code and run it there, instead of compiling for the target hardware.
One of them is. And ability to interpret Python is requirement for any python program to be able to run. Being able to build and deploy a c lib is not.
So, someone has made python run on Foo platform, lets say a watch. If I have a pure python program I can run it on that watch with no more fuss. If I have to rely on a c library then I have to get that ported to Foo platform, maybe dealing with developer keys and making "authorized" signed binary, etc, etc. Pure python is orders of magnitude easier.
That is why "Pure Python" is a thing.
Several standard libs come in pure python and C versions cause pure python is an advantage / requirement for some use cases. And speed is for others.
It's probably not even that hard to embed the CPython interpreter into tmux and allow extensions written in python. If you just wanted to write python extension modules, embedding Python and then wrapping the tmux api with Python using cffi is likely a winner.
This is a frequent and IMHO mostly weird question. I understand the "why reimplement XYZ in $YOURFAVORITELANGUAGE just to have XYZ in $YOURFAVORITELANGUAGE" sentiment but there is an equally valid benefit in using uniform tool stacks. I am a Python developer. I am comfortable working in other languages, and contributing patches to tools written in other languages, but there is a real benefit to having a full toolset written in a single language even if some of those tools are less developed than their counterparts.
This is besides the benefit that even though you might not need tmux in Python, having tmux in Python might have created tmux-the-library which someone might later need.
(I haven't yet tried this but I plan on doing so. On an unrelated note, thanks to the author for making this pure Python, and for caveatting "it's not as fast as C" with "but try PyPy").
(author). This is the first release of Pymux. It should be stable and usable for daily work. However, don't hesitate to create a GitHub issue in case you feel that it lacks some features/responsitivity or when you'd like to see something different. Expect to see more progress in the coming months. Jonathan
Three things I care about are byobu, mouse support and tabs.
Being able to make byobu use this instead would make adoption really easy. Hopefully just documentation and changing one byobu setting for a different binary name somewhere.
Tmux has mouse support but it seems to require config settings (ie doesn't happen by default). I'd rather mouse stuff just works out of the box with no configuration and does the right thing.
I like tabs in the terminal (eg Gnome-Terminal on Linux). I believe there is a Mac term emulator that can map the different screens to tabs. Byobu does help a lot with this, but it would be nice if the terminal can do so too.
Thanks for allowing different viewers to see different screens at the same time. tmux's behaviour of making every viewer see the same one at the same time is highly annoying. (Yes I know there are ponderous workarounds, but seriously?)
+1 for out-of-box mouse event support. This would be the killer feature for me.
Right now, configuring pass-through mouse events in Tmux on a Mac is a huge production. StackOverflow has conflicting advice for each permutation of OSX version + Tmux version, and a lot of stuff changed in the last couple versions of each, such that old advice is entirely useless.
I'd love to see the ability to attach a GUI terminal with tighter integration. I use GNOME Terminal, for example, and when connecting to a multiplexer I'd like every screen to appear as a tab, with the ability to detach again later. I believe iterm2 does this, but it is OS X only.
This is the only thing I currently miss with screen/tmux/byobu.
There are multiple patches for tmux floating around. One of them is even correct, if you want 24bit tmux. My arch and nix machines are both running it.
I'm all for experimenting with new ideas, however this seems to duplicate all the conceptual shortcomings I see in tmux.
First of all, session support and terminal multiplexing are two distinct features which shouldn't be intermingled. What ever happened to the Unix principle of doing one thing and doing it well? My take on this problem is a combination of abduco[1] and dvtm[2].
Next a built in copy mode seems wrong, there is no need to implement vi(m) or emacs key bindings when you can make use of the complete editor. That is why dvtm uses my vim clone vis[3] as a filter: the terminal (scroll back) content is piped to $EDITOR and whatever the editor writes to stdout is kept in a register to be pasted in other terminal windows.
Furthermore I think the completion menu should also be implemented as a standalone tool (using e.g. dmenu or slmenu) as is done for the vis file open dialog.
As a last point I consider Pyhton not really suitable for core system tools, if you want something more expressible than C then something like Rust would probably have been a better choice.
A Slashdot user named sczimme asked Pike this question: Given the nature of current operating systems and applications, do you think the idea of "one tool doing one job well" has been abandoned? If so, do you think a return to this model would help bring some innovation back to software development?
Rob Pike's reply was: Those days are dead and gone and the eulogy was delivered by Perl.
Perl is great for succinct syntax, which is something I admire (who doesn't appreciate backtick for invoking another program?)
This same brevity is valuable in other contexts, but the challenge is in doing it and understanding the implications. So long as such mechanisms don't introduce hidden complexity (e.g. ';' in bash or it's equivalent), succint syntax has my vote. Working in C at a low level and still having to deal with integer overflow shows me that there is definately a middle ground w.r.t. expressivity and details. I'd be happy to see progress in this area.
There are way too many negative remarks about this project. It took a lot of effort to share this project with the world. Presenting alternatives projects and arguments against pymux is a direct assault on everything good about open source, python, and our hacker news community.
54 comments
[ 3.3 ms ] story [ 112 ms ] thread> The big advantage of using Python and prompt_toolkit is that the implementation of new features becomes very easy.
Compared to tmux
To some extend, 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.) 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.
Besides, Pymux is Python while tmux is C. I'm sure you can appreciate that adding a Python API to tmux would be non-trivial, both code-wise and politically.
I personally find this project interesting to see, although I won't be using it.
tmux is comparatively rock solid.
You can see the quickstart at https://tmuxp.readthedocs.org/en/latest/quickstart_python.ht... and the API documentation at https://tmuxp.readthedocs.org/en/latest/api.html.
You can see the testcases we cover use real tmux sessions and monitor the state of the session / window / panes to assert the API functions correctly. https://github.com/tony/tmuxp/tree/master/tmuxp/testsuite
As for pymux, Jonathan Slenders' work on ptpython [1] and prompt_toolkit have been quite nice when working with shell_plus in django or debugging python projects. He's good in this area. Agreed that it's a nice thing to have pymux there.
And agreed that adding native language extensions (python, ruby, etc.) to tmux would be complicated code-wise and perhaps not in the spirit of what it aspires to be. That said, on the tmuxp side of things, a lot could be improved. For example, switching tmuxp to use control mode (-C) and filing smaller patches to expand control mode's events in tmux(1).
[1] https://github.com/jonathanslenders/ptpython
Could've spent a week groking the tmux source code base, another to add the fish features and then an extra week to drink on the beach.
Instead, there are still months ahead meanwhile 99.999% of tmux users will continue using tmux.
It's maybe not a "big" why, or one you care about.
"python some.py" is (in some cases) vastly easier than porting/compiling/signing C code.
So, someone has made python run on Foo platform, lets say a watch. If I have a pure python program I can run it on that watch with no more fuss. If I have to rely on a c library then I have to get that ported to Foo platform, maybe dealing with developer keys and making "authorized" signed binary, etc, etc. Pure python is orders of magnitude easier.
That is why "Pure Python" is a thing.
Several standard libs come in pure python and C versions cause pure python is an advantage / requirement for some use cases. And speed is for others.
This is besides the benefit that even though you might not need tmux in Python, having tmux in Python might have created tmux-the-library which someone might later need.
(I haven't yet tried this but I plan on doing so. On an unrelated note, thanks to the author for making this pure Python, and for caveatting "it's not as fast as C" with "but try PyPy").
Being able to make byobu use this instead would make adoption really easy. Hopefully just documentation and changing one byobu setting for a different binary name somewhere.
Tmux has mouse support but it seems to require config settings (ie doesn't happen by default). I'd rather mouse stuff just works out of the box with no configuration and does the right thing.
I like tabs in the terminal (eg Gnome-Terminal on Linux). I believe there is a Mac term emulator that can map the different screens to tabs. Byobu does help a lot with this, but it would be nice if the terminal can do so too.
Thanks for allowing different viewers to see different screens at the same time. tmux's behaviour of making every viewer see the same one at the same time is highly annoying. (Yes I know there are ponderous workarounds, but seriously?)
Right now, configuring pass-through mouse events in Tmux on a Mac is a huge production. StackOverflow has conflicting advice for each permutation of OSX version + Tmux version, and a lot of stuff changed in the last couple versions of each, such that old advice is entirely useless.
This is the only thing I currently miss with screen/tmux/byobu.
This is the only feature I miss with Tmux since I've been using Neovim with 24bit colors for a while.
pymux --truecolor
First of all, session support and terminal multiplexing are two distinct features which shouldn't be intermingled. What ever happened to the Unix principle of doing one thing and doing it well? My take on this problem is a combination of abduco[1] and dvtm[2].
Next a built in copy mode seems wrong, there is no need to implement vi(m) or emacs key bindings when you can make use of the complete editor. That is why dvtm uses my vim clone vis[3] as a filter: the terminal (scroll back) content is piped to $EDITOR and whatever the editor writes to stdout is kept in a register to be pasted in other terminal windows.
Furthermore I think the completion menu should also be implemented as a standalone tool (using e.g. dmenu or slmenu) as is done for the vis file open dialog.
As a last point I consider Pyhton not really suitable for core system tools, if you want something more expressible than C then something like Rust would probably have been a better choice.
[1] https://github.com/martanne/abduco [2] https://github.com/martanne/dvtm [3] https://github.com/martanne/vis
Rob Pike has the answer for you. http://interviews.slashdot.org/story/04/10/18/1153211/rob-pi...
A Slashdot user named sczimme asked Pike this question: Given the nature of current operating systems and applications, do you think the idea of "one tool doing one job well" has been abandoned? If so, do you think a return to this model would help bring some innovation back to software development?
Rob Pike's reply was: Those days are dead and gone and the eulogy was delivered by Perl.
Perl is great for succinct syntax, which is something I admire (who doesn't appreciate backtick for invoking another program?)
This same brevity is valuable in other contexts, but the challenge is in doing it and understanding the implications. So long as such mechanisms don't introduce hidden complexity (e.g. ';' in bash or it's equivalent), succint syntax has my vote. Working in C at a low level and still having to deal with integer overflow shows me that there is definately a middle ground w.r.t. expressivity and details. I'd be happy to see progress in this area.
https://mosh.mit.edu/