12 ms·
Building Rich Terminal Dashboards
- mraza007 6y agoLooks pretty cool. As someone who uses commandline all the time I think this can be really useful to build TUIs
- solosoyokaze 6y agoIt seems like Python and Node are not good choices for command line tools. Rust or Go make a lot more sense as your end users won’t have to install any libs or package managers. Single binary distribution ftw.
- Scarbutt 6y agoFor an internal app, you could give users restricted ssh access, less pain that giving them binaries.
- pottertheotter 6y agoAs someone who really only knows Python (I'm not a developer), I was thinking the same thing. I think this would be really useful for me to use for some personal projects. Or for libraries for someone who already uses Python. I guess that's enough for it to be useful, but I wish I could package it up better to let someone who doesn't know a thing about Python use what I made.
- solosoyokaze 6y agoIt looks like a great library! Definitely useful for internal tools, personal scripts... As a user I’m just encouraging people not to use an interpreted language to build tools you plan to distribute.
- nhumrich 6y agopip is installed by default on mac and linux. For non posix experienced users, pip installing packages is actually easier than figuring out how to put a binary on the path. Not to mention, updates are just a command, you dont have to go find the url, redownload, and replace the binary.
- solosoyokaze 6y agoRealistically speaking people will most likely install cli tools with brew on mac. People shouldn’t be pip installing things without virtualenv anyway.
- yjftsjthsd-h 6y agoIn that case it's irrelevant whether the thing is shipped as a normal python package, a static binary, or anything else, since it just comes from brew anyways.
- zaphirplane 6y agoI thought macOS stopped shipping with python
- em500 6y agoPip is not installed by default on macOS, and even python itself will be removed in some future version.
- wyqydsyq 6y agoExcept you can bake apps into a single stand-alone binary executable for both Node.JS[1] and Python[2] [1] https://www.npmjs.com/package/pkg https://www.npmjs.com/package/pkg [2] https://github.com/marcelotduarte/cx_Freeze https://github.com/marcelotduarte/cx_Freeze
- sokoloff 6y agoCan’t you just shebang a python script to make it feel like a normal executable?
- CoffeeDregs 6y agoSure but you can't shebang all of the deps... Unless your `normal executable` embeds a Python dependency-manager.
- d0mine 6y ago#!/usr/bin/fades https://github.com/PyAr/fades#what-is-fades https://github.com/PyAr/fades#what-is-fades
- wyqydsyq 6y agoYou can do it with Node as well, this works: #!/usr/bin/env node But similarly to with Python, it still requires you have the runtime installed along with any packages your thing depends on
- ttyprintk 6y agoIf you zip a Python package with a __main__.py, it’s executable by the interpreter.
- medecau 6y agohttps://shiv.readthedocs.io/en/latest/ https://shiv.readthedocs.io/en/latest/ https://pex.readthedocs.io/en/latest/ https://pex.readthedocs.io/en/latest/
- otikik 6y agoRust has several interesting TUI libraries too. Check https://github.com/fdehau/tui-rs https://github.com/fdehau/tui-rs for example.
- lifeisstillgood 6y agoI like this as I find for most things a TUI is simpler to write and 95% as useful - especially for work small tools - where you are making something you might use a few times and just want to throw it in the toolbox and maybe just have a minor UI to guard against horrors. Being this simple looks enticing
- pugio 6y agoDoes anyone know of a similar library for node which does this? I've decided to make my next app TUI first, and then only add in a GUI much later, but I haven't seen anything that looks nearly as good as rich.
- acemarke 6y agoThere's `blessed` [0], a plain JS lib similar to `ncurses`. There's also `react-blessed` [1], which is a React renderer that targets `blessed` as the display layer, and `ink` [2], which is also a text-based React renderer but using its own display layer. [0] https://github.com/chjj/blessed https://github.com/chjj/blessed [1] https://github.com/Yomguithereal/react-blessed https://github.com/Yomguithereal/react-blessed [2] https://github.com/vadimdemedes/ink https://github.com/vadimdemedes/ink
- woutr_be 6y agoIf you plan on using blessed, there’s also blessed-contrib, which is a library of widgets for blessed. https://github.com/yaronn/blessed-contrib https://github.com/yaronn/blessed-contrib
- dfee 6y agoThis is so cool! I knew about Ink, but not Blessed. Curious as to people’s experience using Blessed-React vs Ink.
- deleted 6y ago[deleted]
- pugio 6y agoI saw blessed, thank you, but the last commit was in 2016, and I'm a bit wary of a JS library with that level of activity.
- duncanbeevers 6y agoInk may be the tool you're looking for. https://vadimdemedes.com/posts/ink-3 https://vadimdemedes.com/posts/ink-3 It lets you write React CLI apps using a flexbox layout engine, and is used by a number of high-profile node projects.
- krasin 6y agoThe most productive tools I built for non-programmers were using text UI. They were fast, clean, obvious to use. Turbo Pascal made it especially easy with good support for menus and windows / panes. Nowadays, terminals have no problem with mouse support, which everyone can test by starting htop in a terminal and clicking with a mouse on a column title to sort by it.
- tra3 6y agoIs this better than splitting panes up with Tmux or similar? You end up losing the ability to pipe things. What do you gain?
- ramraj07 6y agoLooks like its powerful because you can have a loop and update metrics you can get via python. I've always wanted to create something like vtop but for network and disk io, this might finally let me do it myself.
- rataata_jr 6y agoTake a look at `glances'. I think it does what you want.
- rodgerd 6y agoThe ability to wrap up arbitrary data sources into an attractive, easy-to-parse TUI. If you have a bunch of things you look at via watch or something similar, wrapping them in this seems like a natural.
- javbit 6y agoYou could detect if stdout is a terminal and then decide for fanciness or machine readability. I think this, along with flags for manually setting rich features, would provide the best of both worlds.
- tra3 6y agoAhh didn’t know that was a thing. Thanks for setting me straight.
- jph00 6y agoI'm one of the developers of ghtop (along with Nat Friedman, who made the original version, and Hamel Husain), which, as mentioned in the post, kinda inspired this new direction for Rich. You can see screenshots of what we made here: https://ghtop.fast.ai/ https://ghtop.fast.ai/ . Rich is really great. It didn't actually need us to add much to make it work as a terminal layout manager too - all the pieces were really there already for us to build on. Let me know if you have any questions about our experiences with Rich and ghtop.
- rexreed 6y agoThe future repeats the past. This looks much like the back-end systems I used to design on TurboPascal in the late 1980s / early 1990s. https://ilyabirman.net/meanwhile/pictures/tp-80.png https://ilyabirman.net/meanwhile/pictures/tp-80.png
- naikrovek 6y agoI miss the simplicity and utility of textual UIs. Nothing unneeded, and everything you need. No filler. No giant gaps between elements or wasted pixels. No fads which do silly things like hide scrollbars or other interactive elements. Except for CAD applications and some games, almost everything we do online today could be accomplished via textual UI. Almost the entire internet could be replaced with TUIs and a lot of things would be better and more straightforward, and nearly everyone would be able to do what they need to do online. TUIs are fast, they are light, they are ultra responsive and ... Yeah. They're definitely underrated. They're probably a lot easier for screen-readers, too. I'm not suggesting that we undo everything and make a TUI web, but I do want to point out that we do a hell of a lot on today's UIs that we don't need to do, solely because some designer who wants to make pretty things that function poorly said so.
- rexreed 6y agoWhere's lynx when you need it? [0] [0] https://lynx.browser.org/ https://lynx.browser.org/ And I might add, it's the oldest web browser still being maintained. Since 1992.
- jeroenjanssens 6y agoWhy does this website write "Un*x" as if it's some kind of swear word?
- soneil 6y agoIt's a common way to express "things that are unix-like" and avoiding the pedanticism of what is & isn't an actual UNIX™
- corysama 6y agoFor C++ers, there’s ImTui https://github.com/ggerganov/imtui https://github.com/ggerganov/imtui an ncurses backend for ImGui https://github.com/ocornut/imgui https://github.com/ocornut/imgui
- ggerganov 6y agowtfutil is a another terminal dashboard [0]. It uses .yml configuration files to define the layout and the content of the splits. At some point, I used ImTui to create a more convenient way to create these .yml configuration files: wtf-tui [1]. I also made an emscripten port of wtf-tui for easy testing in the browser [2] [0] - https://wtfutil.com https://wtfutil.com [1] - https://github.com/ggerganov/wtf-tui#wtf-tui https://github.com/ggerganov/wtf-tui#wtf-tui [2] - https://wtf-tui.ggerganov.com https://wtf-tui.ggerganov.com
- l33t_d0nut 6y agoI wrote a post about doing this in PowerShell https://blog.ironmansoftware.com/tui-powershell/ https://blog.ironmansoftware.com/tui-powershell/
- Nerada 6y agoThis is brilliant, thanks for sharing!
- deleted 6y ago[deleted]
- alberth 6y agoIf you like terminal dashboards, Go Access has a nice one for web analytics. https://goaccess.io/ https://goaccess.io/
- aduitsis 6y agoVery nice! There is a certain appeal to having simple, versatile and robust systems such as a terminal emulator to build upon instead of complex APIs that require many many hours just to understand their asynchronous operation and complexities. Combined with Unicode, there seems to be a small renaissance in the area of what can be done in a terminal, which is both nostalgic and refreshing! And, terminal emulators such as iTerm can nowadays display images. And vector or bitmapped graphics were actually a thing once. E.g. I believe xterm can still understand and display https://en.wikipedia.org/wiki/ReGIS https://en.wikipedia.org/wiki/ReGIS graphics. Surely there must be better and simpler alternatives that I may be missing. Having an empty canvas and drawing to it without too much hassle is reminiscent of the era when this was done with a few lines of BASIC.
- lumpa 6y agoJust realized that the post author submitted[0] it hours before I did, but it didn't come up in search because it was dead at the time. This is sad because Will writes great posts[1] and great software[2], but somehow his submissions mentioning Rich tend to end up dead. Would it be a case of bad project name for HN titles? [0] https://news.ycombinator.com/item?id=26147831 https://news.ycombinator.com/item?id=26147831 [1] https://www.willmcgugan.com/blog/tech/ https://www.willmcgugan.com/blog/tech/ [2] https://github.com/willmcgugan https://github.com/willmcgugan
- swyx 6y ago@dang perhaps worth merging into the original author's post to give them credit?
- OJFord 6y agoAnd if a mod does see this, maybe they'll consider also Dispensing With The Title Case - since it reduces the information in the original article title ('Building Rich terminal dashboards') by obscuring that Rich is the name of the Python package behind it, and it doesn't (just) mean adjectivally rich (other than I'm sure that's the reason for the framework's name). (Bit of a bee in my bonnet because I never like Title Case In Submissions Even If The Article Itself Uses It anyway, but it's especially unfortunate here.)
- lumpa 6y agoI think it was changed to title case by a mod. It might have been automatically changed on submission without me noticing. But I'm sure it was submitted with the proper capitalization you suggest.
- OJFord 6y agoHN does it automatically on submission, but you can edit it and it leaves it alone then.
- willm 6y ago
- xx789 6y agoI dont need menus or dialogs, just something simple like top. Would this be the right library to use?
- Zee2 6y agoFrom the example posted above of ghtop, I think the answer for that is "yes".
- ldd 6y agoIs there something like this for node(javascript/typescript)?
- dreamer7 6y agoThis is really interesting! I've been thinking of creating a TUI version of a marketplace I'm running in the UK. The idea is that most of our time on marketplaces is spent on discovering the product we are looking for and that is much easier to do without all the bloat of modern apps. What do the people on HN think?
- prepperdev 6y agoCraigslist approves: https://sfbay.craigslist.org/ https://sfbay.craigslist.org/
- gorbypark 6y agoGreat idea. I've been toying around with Ink, which is a TUI renderer for React. My idea is to port our existing React front end to it and offer an installable "native" TUI front-end option for our service.
- jdnier 6y agoThe Console and Layout api looks really simple for creating dashboards. Another option for full-screen apps is Python Prompt Toolkit[1], which also handles keyboard and mouse input and can be used to implement editors[2]. [1] https://github.com/prompt-toolkit/python-prompt-toolkit https://github.com/prompt-toolkit/python-prompt-toolkit [2] https://github.com/prompt-toolkit/pyvim https://github.com/prompt-toolkit/pyvim
- jdnier 6y agoAlso, maybe of interest... > prompt_toolkit 3.0 is completely type annotated and uses asyncio natively. The rich source is also type annotated and very clean and readable.
- samorozco 6y agoIs it just me or does it seems like we're going backwards with things like this?
- theodric 6y agoAs someone who's not a fan of most of Tech's trends over the last sixteen years: good. Let's go back to lightweight, information-rich, performant interfaces.
- leg100 6y agoDoes anyone have a recommendation for implementing an equivalently flashy terminal dashboard in golang? https://github.com/gizak/termui https://github.com/gizak/termui ? https://github.com/mum4k/termdash https://github.com/mum4k/termdash ?
- willm 6y agoAuthor of Rich here. Happy to answer any Rich related questions.
- sep_field 6y agoThis is awesome! Do you have plans/a timeline for keyboard/mouse input?
- willm 6y agoPlans, yes. Still thinking about the best way to do it without inventing too many wheels. Timeline depends on inspiration and free time. Although lately with the pandemic free time hasn't been a problem.
- yourapostasy 6y agoI commented on this in another HN discussion thread [1] on Blessed [2]. You might want to look at what Vermont Views did [3] to avoid reinventing the wheel of what to implement. I'm sure if you put the call out for it, someone, somewhere, reading on HN, will be able to post up the documentation if you want a detailed look, or send you the obfuscated source code (which these days could probably be re-constituted with modern re-factoring editors). I tried emailing and hard copy mail contacting them a few years back to buy the rights so I could turn around to open source it as I anticipated a resurgence of interest in TUI's because the browser-based latency issue is simply not improving fast enough, but never got a response, so as far as I can tell, they went abandonware (their corporate form is inactive [4], but someone is updating their office address as recently as a couple years ago, so I might give a shot at contacting them again). [1] https://news.ycombinator.com/item?id=14405186 https://news.ycombinator.com/item?id=14405186 [2] https://github.com/chjj/blessed https://github.com/chjj/blessed [3] http://web.archive.org/web/20091011010412/http://www.vtsoft.com/vcsproducts/vviews.html http://web.archive.org/web/20091011010412/http://www.vtsoft.... [4] https://opencorporates.com/companies/us_vt/0107727 https://opencorporates.com/companies/us_vt/0107727
- jawns 6y agoDo you foresee any interplay behind a tool like Rich and terminal emulators like iTerm2, which provides some pretty sophisticated triggers based on terminal output? Or do you see them as two fundamentally different things with little overlap?
- joseluis 6y agoAnd there's also Notcurses[0][1], which facilitates the creation of modern TUI programs, making full use of Unicode and 24-bit TrueColor. It presents an API similar to that of Curses, riding atop Terminfo. It's made in C, with C++, Python & Rust wrappers. [0] https://notcurses.com/ https://notcurses.com/ [1] https://github.com/dankamongmen/notcurses https://github.com/dankamongmen/notcurses
- ho_schi 6y agoInteresting how the show their work results in a completely differnt way. I'm looking at it, because the C, C++ and the Rust interface are my working area. I love TUIs and think they are used to less. Easy usage, concise overview and high efficiency. TUIs seem to naturally restrict itself, keep tight to the task and therefore work better. Mileage may vary well ;)
- rbanffy 6y agoRestraint is a great tool for engineers. When you can't to everything, you focus on what matters the most. I used to have an IBM 3151 terminal on my desk (I wish I could afford a 3278/9 or 3290) connected over 9600 bps to my workstation. It's a great to remind me to keep things simple.
- sidpatil 6y agoI have the same one on my desk, for the same reason.
- rbanffy 6y agoUsing curses also allows it to work on terminals that are not ANSI terminals (even though most of the actual hardware that still survives understand most of the VT-100 sequences). Also, not all terminals have uniform coverage for ANSI codes. Apple's Terminal.App does a good job with double-width and double-height, but lacks the SGR 53 overline that VTE, Konsole and Microsoft Windows Terminal have (and that makes status lines so much better).
- rsync 6y ago
- federico_c 6y ago[Sorry for the spam] If you want to create charts quickly there's also: https://github.com/FedericoCeratto/dashing https://github.com/FedericoCeratto/dashing
- lumpa 6y agoLooks great, thanks for the link! Some very nice examples of other cool stuff that depends on the blessed Python package: https://github.com/jquast/blessed https://github.com/jquast/blessed
- willm 6y agoRich author here. It does look great, I like the API design. Would you consider adding an integration for Rich? In theory it should be possible to have your charts object also work within a Rich layout, using the Console Protocol. https://rich.readthedocs.io/en/latest/protocol.html https://rich.readthedocs.io/en/latest/protocol.html
- LukeB42 6y agoReminds me of Window, which has keyboard input: https://github.com/lukeb42/window https://github.com/lukeb42/window https://github.com/lukeb42/emissary https://github.com/lukeb42/emissary
- Noxmiles 6y agoI don't want my terminal tools rely on a Python pip library. This Rich really looks cool and is nice, but nothing for (my) server use. (Thanks to @joseluis who posted about notcurses here)
- dutzi_ 6y agoCheck out React Ink, it's pretty slow and probably not as polished/feature packed, but it does the job. That being said, working in the CLI with a GUI does not work very well. Having the option to search for strings logged in some pages ago is really handy.
- mightybyte 6y agoThere's a slick little Haskell library that does something similar called reflex-vty: https://github.com/reflex-frp/reflex-vty#reflex-vty https://github.com/reflex-frp/reflex-vty#reflex-vty One thing neither of these libraries appear to have done yet that I would really like is create a more compact window rendering. Currently each window gets a 1-character border. What I would like is something that saves space by collapsing adjacent windows' borders into a single character instead of having two redundant borders next to each other. Of course I get why they do it the way they do, but terminals are often more constrained for space and with complex UIs you can lose a fair amount due to these unnecessary borders. That would be the next thing I'd hack on to improve these kinds of libraries. But alas...too many fun projects to hack on and not enough hours in the day.
- itronitron 6y agoJava devs might be interested in Lanterna >> https://github.com/mabe02/lanterna https://github.com/mabe02/lanterna https://news.ycombinator.com/item?id=8042106 https://news.ycombinator.com/item?id=8042106
- mixmastamyk 6y agoHow does this compare to Urwid, in terms of features, which I've used in the past to build such interfaces? For simpler stuff I often use my own console package, which everyone should write once, haha. Architecturally however, I think terminal primitives and widgets should be separate layers/packages.