An extremely useful hidden gem in Rich is its `inspect` function [1].
When called on an object, it pretty prints a list of its public attributes (though you can also request private and dunder attributes) [2]. It can also be called on a class or function; it'll then pretty print the docstrings, parameters with types, methods, etc. It's great for debugging and for starting to code with libraries you're not familiar with, don't have comprehensive documentation, or have some dynamic aspect.
In a similar vein, `objexplore` [3] is another library that lets you dive into an object's nested attributes to understand how it's laid out.
In interactive debugging sessions I often find these to be more useful than the IDE's features which provide similar functionality.
A good video walkthrough of Textual from September, 2021 with Paul Everitt interviewing the author, Will McGugan: A Look At – and Inside – Textual (https://www.youtube.com/watch?v=1kTWxamIJ_k).
I am not sure if it's only me, but as time passes I find myself using more and more simple Terminal stuff. No fancy air/earth lines, no fancy formatting, no fancy ligatures or typefaces.
Oddly, I'm the opposite. Working in devops and vscode, I find the visual aspect of color and logical formatting improves my work dramatically. Small tools like "bat" vs. "cat" on the terminal are great at quick data parsing for things like yaml, json, and the like. Staying old school for the sake of old school is a bit of a fallacy IMHO.
We have 5k monitors, Gpus with 12GB of RAM, fast networks, etc. color in consoles, underline, bold and italics seem overdue.
What rubs me wrong is the collective halfassedness of it all. When less craps out ANSI codes, when the terminal tears and your cursor is offset because it got confused about control characters, dozens of different color configs rather than a system theme.
There was this time in the Linux dark ages, red hat Linux 2 era. The enlightenment window manager was considered part of protocol GNOME, there were a lot of really exotic or organic themes, skinning was the hotness. Windows couldn’t do it. Ux be damned, if you wanted your desktop to look like some sort of demonic rune set, you could do it. Rationality, ux, consistency, etc took over. Cli skinning never seems to grow that way. I keep hoping some hacker that doesn’t know better will write a new terminal emulator, replaces ANSI codes with some minimal html and invents console css and the community embraces it.
I tend to agree with this. I'm not anti-formatting, but it seems that in the majority of cases, the "formatting" isn't done artfully, and actively makes it harder to read command output, etc.
Personally, I find colors distracting, so I do the opposite: I use text attributes more and more, like bold, faint, underline, italics (...) even in my bash prompt
Absolutely. I still have a Terminal window open all the time to do various tasks. The ability to say 'find me x or y or z' and not having the overhead of looking through other visual clutter. Plus a few well chosen directory jump shortcuts make things easier.
Nope, not just you. Been coding since the 80's, and command-line tooling has become more noisy and less parser/redirect-friendly over the past decade (but option parsers have def. gotten better). To be fair, once terminals started supporting escape color codes, things started to fall apart (circa late 90's). IMHO.
EDIT: Just noticed a peer comment below captures the issues with ANSI way better than I did.
The way structlog and rich work together makes for a really great and simple development experience;
Stack traces are presented in a gorgeous fashion, log.debug lines have lots of great meta data with them. I almost always start new projects with those as my first imports.
I've been following Will McGugan (the author) on twitter for a while. I learnt PyGame from his book. He more or less documented his thought processes on twitter and it's been very nice to see it develop over time.
It got me thinking that, atleast for technology developers, this is the ideal use of twitter. An uncensored "thoughtstream". Some tools to mine that and extract lessons might be an interesting project.
This would be so helpful. About a year ago I got the combination of FZF and bat working for my command line history. It’s wild how much better and easier that makes it to find complex commands from the past.
I think the quick answer is that they most certainly didn't. Vim or Emacs are popular and fill most use cases while obviously working in dozens of other languages. For actual text rendering use cases their are plenty of popular libraries such as curses
[+] [-] pedrovhb|4 years ago|reply
When called on an object, it pretty prints a list of its public attributes (though you can also request private and dunder attributes) [2]. It can also be called on a class or function; it'll then pretty print the docstrings, parameters with types, methods, etc. It's great for debugging and for starting to code with libraries you're not familiar with, don't have comprehensive documentation, or have some dynamic aspect.
In a similar vein, `objexplore` [3] is another library that lets you dive into an object's nested attributes to understand how it's laid out.
In interactive debugging sessions I often find these to be more useful than the IDE's features which provide similar functionality.
[1] https://rich.readthedocs.io/en/stable/reference/init.html#ri...
[2] https://i2.paste.pics/798cff2903f6b3351289a24c839d4f44.png
[3] https://github.com/kylepollina/objexplore
[+] [-] orf|4 years ago|reply
[+] [-] samwillis|4 years ago|reply
https://github.com/Textualize/textual
[+] [-] agumonkey|4 years ago|reply
[+] [-] jdnier|4 years ago|reply
[+] [-] elteto|4 years ago|reply
[+] [-] bitigchi|4 years ago|reply
[+] [-] planetafro|4 years ago|reply
[+] [-] TheCondor|4 years ago|reply
What rubs me wrong is the collective halfassedness of it all. When less craps out ANSI codes, when the terminal tears and your cursor is offset because it got confused about control characters, dozens of different color configs rather than a system theme.
There was this time in the Linux dark ages, red hat Linux 2 era. The enlightenment window manager was considered part of protocol GNOME, there were a lot of really exotic or organic themes, skinning was the hotness. Windows couldn’t do it. Ux be damned, if you wanted your desktop to look like some sort of demonic rune set, you could do it. Rationality, ux, consistency, etc took over. Cli skinning never seems to grow that way. I keep hoping some hacker that doesn’t know better will write a new terminal emulator, replaces ANSI codes with some minimal html and invents console css and the community embraces it.
[+] [-] jonpalmisc|4 years ago|reply
[+] [-] csdvrx|4 years ago|reply
Example: https://raw.githubusercontent.com/csdvrx/bash-timestamping-s...
[+] [-] rajandatta|4 years ago|reply
[+] [-] JoelEinbinder|4 years ago|reply
[+] [-] SavantIdiot|4 years ago|reply
EDIT: Just noticed a peer comment below captures the issues with ANSI way better than I did.
[+] [-] sdfgsdf|4 years ago|reply
[+] [-] gnubison|4 years ago|reply
[+] [-] gloriana|4 years ago|reply
[+] [-] yeetaccount4|4 years ago|reply
Not sure how people put up with all that powerline stuff either, or multi-line PS1s that have shit on either side. Reminds me of geocities.
[+] [-] asicsp|4 years ago|reply
Show HN: Python lib for rich text, markdown, tables, etc. in the terminal (https://news.ycombinator.com/item?id=23070821 2020, 47 comments)
Related discussion:
Textual: a Python text user interface with Rich as the renderer (https://news.ycombinator.com/item?id=27526031 7 months ago, 21 comments)
[+] [-] 0x008|4 years ago|reply
[+] [-] dayjah|4 years ago|reply
Stack traces are presented in a gorgeous fashion, log.debug lines have lots of great meta data with them. I almost always start new projects with those as my first imports.
[+] [-] kubami|4 years ago|reply
[+] [-] noufalibrahim|4 years ago|reply
It got me thinking that, atleast for technology developers, this is the ideal use of twitter. An uncensored "thoughtstream". Some tools to mine that and extract lessons might be an interesting project.
[+] [-] nyellin|4 years ago|reply
1 tabulate: helps render ASCII tables in various formats (https://github.com/astanin/python-tabulate)
2. typer: write cli commands by decorating python functions. It uses type annotations to automatically parse input (https://typer.tiangolo.com/)
We're using both of those in our Kubernetes troubleshooting tool (https://robusta.dev). Going to look at adding Rich too
[+] [-] qorrect|4 years ago|reply
[+] [-] ZeroGravitas|4 years ago|reply
[+] [-] pridkett|4 years ago|reply
[+] [-] aseipp|4 years ago|reply
That said it doesn't push "input controls" quite to the extreme Rich/Textual do for UI controls, but it might be a starting point to look into.
[+] [-] adambyrtek|4 years ago|reply
[+] [-] rajandatta|4 years ago|reply
[+] [-] unknown|4 years ago|reply
[deleted]
[+] [-] armchairhacker|4 years ago|reply
[+] [-] asimjalis|4 years ago|reply
[+] [-] rjzzleep|4 years ago|reply
[+] [-] mrits|4 years ago|reply
[+] [-] willm|4 years ago|reply
[+] [-] unknown|4 years ago|reply
[deleted]
[+] [-] jack_pp|4 years ago|reply
[+] [-] atarian|4 years ago|reply
[+] [-] zashackernews|4 years ago|reply
[+] [-] jmakov|4 years ago|reply
[+] [-] DoneWithAllThat|4 years ago|reply
[+] [-] budafish|4 years ago|reply
[+] [-] F00Fbug|4 years ago|reply
https://github.com/Delgan/loguru
[+] [-] comonoid|4 years ago|reply
[+] [-] iqanq|4 years ago|reply
[+] [-] willm|4 years ago|reply
[+] [-] kortex|4 years ago|reply
Well, you can tell from the way I use nGrok, I'm a jq man, no time for awk