Talk Python To Me

#336: Terminal magic with Rich and Textual

16 snips
Oct 5, 2021
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

Rich Uses A Composable Renderable Model

  • Rich is a composable rendering system that writes styled, wrapped, and high‑level objects to the terminal instead of simple strings.
  • Tables, progress bars, syntax highlighting and other renderables can nest inside each other because Rich renders to an intermediate segment model first.
ADVICE

Follow Semver Strictly For Widely Used Libraries

  • Be strict with semantic versioning for popular libraries to avoid breaking users' code without warning.
  • Will learned this after making an unannounced breaking change and now bumps major versions for any API-incompatible change.
ADVICE

Export Rich Output To HTML For Jupyter

  • Use Rich's HTML export to make terminal output display correctly inside Jupyter notebooks and avoid browser wrapping issues.
  • Will wrapped Rich's HTML export so notebooks show the same formatted tables, colors and layouts as the terminal.
Get the Snipd Podcast app to discover more snips from this episode
Get the app