7 ms·
Show HN: Python lib for rich text, markdown, tables, etc. in the terminal
- danso 6y agoVery cool, looks nice enough to try throwing it in my projects right now (since I've never settled on a proper output formatter).
- ashton314 6y agoReminds me of my own Marked-Man utility [1], but this is way prettier. Definitely will have to check this out. Maybe I'll redo marked-man with this lib. [1]: https://github.com/ashton314/marked-man https://github.com/ashton314/marked-man
- dec0dedab0de 6y agoThis looks great. I love stuff like this, especially that it is cross platform. One thing that would be nice to see is a list of which terminals are supported, or at least what the various terminals support.
- billowycoat 6y agoThanks. Should work with any xterm compatible terminal, and Windows legacy terminal.
- Mizza 6y agoThis really rocks, man, can't wait to use it. I used to use 'Clint', but this is even more robust.
- 1337shadow 6y agoExcellent ! Really love the traceback coloration, would love to have that enabled by default, should probably check pythonrc if it can hook that up. Also, RST support would be nice to render docstrings. Also, nice sphinx docs dir, perhaps enable rtfd.io or something that will publish them somewhere as HTML ?
- billowycoat 6y agoSome good ideas there. I’m hoping that people will build such things on top of Rich. I don’t want to add much more to the core lib...
- 1337shadow 6y agoWell I have just finished a sub-optimal color implementation with also my own print() implementation in https://yourlabs.io/oss/cli2 https://yourlabs.io/oss/cli2 and I'd be willing to throw another week at it, but didn't really identify how rich could help exactly, if you want to open a ticket there then we can start a discussion See some screenshots: https://yourlabs.io/oss/cli2/uploads/1bb0d9278047b4656f97ebbfe3f59b19/2020-05-05-112049_1026x700_scrot.png https://yourlabs.io/oss/cli2/uploads/1bb0d9278047b4656f97ebb... https://yourlabs.io/oss/cli2/uploads/8692ed0815082af8a903619a05ec3ce1/2020-05-05-112102_1051x397_scrot.png https://yourlabs.io/oss/cli2/uploads/8692ed0815082af8a903619... Still working on the rendering part Keep up the great work
- alexpetralia 6y agoIs anyone able to get this working in PyCharm? I can get it working on both a shell Python and iPython console, but not in the PyCharm console.
- billowycoat 6y agoNever tried PyCharm. Do you know if it handles Color normally?
- heavyset_go 6y agoFile a bug report with JetBrains.
- kstrauser 6y agoI'm blown away. That's amazingly gorgeous!
- billowycoat 6y agoThanks!
- ipsum2 6y agoLooks great! Any chances of curses or other TUI integration, or is that out of scope for the project?
- billowycoat 6y agoI had a vague notion of building some kind of UI on top of Rich, but tbh I want to reclaim some spare time after 1.0.
- noah_buddy 6y agoThanks for making this and thanks for making time to take care of yourself! Cultivating your creative energies is an achievement in itself.
- _e 6y agoPerfect timing. I was looking at Urwid (http://urwid.org/ http://urwid.org/) last night for a new project. Urwid is a console user interface library for python.
- rozab 6y agoOther great tools in the python terminal sphere are colorama, blessings and urwid. Colorama is just for cross platform colouring, blessings is a very elegant wrapper over curses which is still useful for not-fullscreen things, and urwid is a full-blown widget library for TUI stuff.
- jquast 6y agoplease also consider blessed, an API-compatible fork of blessings that adds Windows 10 support, 24-bit color, keyboard input, and more. https://blessed.readthedocs.io/en/latest/intro.html#brief-overview https://blessed.readthedocs.io/en/latest/intro.html#brief-ov...
- jnwatson 6y agoDon’t forget prompt-toolkit. Notably it is a dependency of the truly excellent IPython shell.
- djsumdog 6y agoI have a short block of code I put in a lot of projects with just color output and formatting. But now I really want to start using this. I like that it's cross platform and you can do very simple things or very complex formatting. This is super neat.
- maest 6y agoRelated to this - is there a way to have a similar rich-styling library designed for email outputs? I have some daily reports generated by a python script via cron. The script currently outputs plaintext and the email just adds <pre> tags around the output, for formatting purposes. Some spicier formatting would be nice.
- billowycoat 6y agoThere is an method to export the terminal as HTML. See https://rich.readthedocs.io/en/latest/reference/console.html#rich.console.Console.export_html https://rich.readthedocs.io/en/latest/reference/console.html... Here is an example of the output https://rich.readthedocs.io/en/latest/appendix/colors.html https://rich.readthedocs.io/en/latest/appendix/colors.html
- dave_sullivan 6y agoThis is awesome. I’ve used termcolor and urwid in the past, will give this a shot.
- hagy 6y agoThis is great! Will certainly be using it in all my command line tools and scripts. Particularly the log handler. Also, like how it has special support for Jupyter notebooks. Thanks for developing this.
- simonw 6y agoThis is SO cool! Amazing collection of features, really clean API design. I had no idea how much I wanted this.
- kelsolaar 6y agoAwesome work, the Jupyter notebook support is really appreciated!
- tvb12 6y agoIt would be awesome for manpages and vim helpfiles to have formatting and color like this.
- kmundnic 6y agoIf you're willing to use zsh, there's an oh-my-zsh plugin to color the manpages, and you can adjust the colors as described here [1]. [1] https://unix.stackexchange.com/questions/501156/personalize-colored-man-pages-zsh-plugin-colors https://unix.stackexchange.com/questions/501156/personalize-...
- tvb12 6y agoThanks, I'll check this out.
- jpxw 6y agoWow. That progress bar - I’m sold. Looking forward to trying it out
- stonecharioteer 6y agoI've been using "rich" for last month and I love it. It makes nested progress bars easy. There is still a lot left to desire but it is amaze balls.
- 20wenty 6y agoIt's beautiful, but what I love most is the detailed README. Thank you for the attention to detail.
- trogdorunique 6y agoCame to echo many others here - great work and fantastic attention to detail. Thanks for your effort.
- willm 6y agoGracias
- gunshai 6y agoThis is really cool! How did you even go about building something like this.
- madhadron 6y agoLovely work, and I feel sad that this kind of labor inside a teletype emulator is something we consider anything but niche nostalgia in 2020.
- willm 6y agoI felt for sure we would have Minority Report interfaces by 2020, but looks like we're stuck with terminals until retirement.
- ablekh 6y agoExcellent work, kudos! By the way, as a freelance software developer, do you work with Flask or other frameworks (instead of Django), if needed?
- robifis 6y agoAbsolutely love this. Will implement it in my CLI games.
- willm 6y agoI'd love to see that! Tweet @willmcgugan when you have something :)
- op03 6y agoReally cool esp the table stuff and pretty printing list and dicts in color. This might be useful to integrate into pandas, BeautifulSoup etc
- jarpineh 6y agoI'll add my grateful thanks. Rich has already become my go-to tool for various Python stuff. I use these days Code's Python file with notebook cell comments. With this I can use console and Jupyter Notebook style rendering depending on wether I'm using regular IPython or Code's Interactive Window. I'm adapting my console printing to leverage Rich's features for Django querysets and other objects I'm dealing with. Rich gives me poor man's Jupyter Notebook widgets. Now I don't need to switch to ipynb files for browser based JS widgets much at all.
- willm 6y agoGood to hear its useful to you. :)
- bobbydreamer 6y agoRight on time