|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Python Rich Library\n", |
| 8 | + "\n", |
| 9 | + "This notebook is a quick overview of the Python Rich library. Rich is a Python library for rich text and beautiful formatting in the terminal. It is a great tool for creating beautiful and interactive text-based interfaces.\n", |
| 10 | + "\n", |
| 11 | + "- [Rich Documentation](https://rich.readthedocs.io/en/latest/)\n", |
| 12 | + "- [GitHub Source and Demos](https://github.com/Textualize/rich)\n", |
| 13 | + "\n", |
| 14 | + "## Installation\n", |
| 15 | + "\n", |
| 16 | + "You can install the Rich library using pip:\n", |
| 17 | + "\n", |
| 18 | + "```bash\n", |
| 19 | + "pip install rich\n", |
| 20 | + "```\n" |
| 21 | + ] |
| 22 | + }, |
| 23 | + { |
| 24 | + "cell_type": "code", |
| 25 | + "execution_count": null, |
| 26 | + "metadata": {}, |
| 27 | + "outputs": [], |
| 28 | + "source": [ |
| 29 | + "! pip install rich" |
| 30 | + ] |
| 31 | + }, |
| 32 | + { |
| 33 | + "cell_type": "code", |
| 34 | + "execution_count": 1, |
| 35 | + "metadata": {}, |
| 36 | + "outputs": [], |
| 37 | + "source": [ |
| 38 | + "from rich import print" |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + "cell_type": "code", |
| 43 | + "execution_count": 5, |
| 44 | + "metadata": {}, |
| 45 | + "outputs": [ |
| 46 | + { |
| 47 | + "data": { |
| 48 | + "text/html": [ |
| 49 | + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">🔥 Hello, <span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">World</span>! 🧛\n", |
| 50 | + "</pre>\n" |
| 51 | + ], |
| 52 | + "text/plain": [ |
| 53 | + "🔥 Hello, \u001b[1;35mWorld\u001b[0m! 🧛\n" |
| 54 | + ] |
| 55 | + }, |
| 56 | + "metadata": {}, |
| 57 | + "output_type": "display_data" |
| 58 | + } |
| 59 | + ], |
| 60 | + "source": [ |
| 61 | + "print(\":fire: Hello, [bold magenta]World[/bold magenta]!\", \":vampire:\")" |
| 62 | + ] |
| 63 | + }, |
| 64 | + { |
| 65 | + "cell_type": "markdown", |
| 66 | + "metadata": {}, |
| 67 | + "source": [ |
| 68 | + "## Go through the following Examples on a Terminal\n", |
| 69 | + "\n", |
| 70 | + "- run the following examples from command line\n", |
| 71 | + "\n", |
| 72 | + "```bash\n", |
| 73 | + "$ python -m rich.table\n", |
| 74 | + "$ python -m rich.progress\n", |
| 75 | + "$ python -m rich.status\n", |
| 76 | + "$ python -m rich.columns\n", |
| 77 | + "$ python -m rich.tree\n", |
| 78 | + "$ python -m rich.panel\n", |
| 79 | + "$ python -m rich.box\n", |
| 80 | + "```\n", |
| 81 | + "\n", |
| 82 | + "- look at examples from GitHub source\n", |
| 83 | + "\n", |
| 84 | + "- Console API\n", |
| 85 | + "- Styles\n", |
| 86 | + "- Prompt\n", |
| 87 | + "- Progress\n", |
| 88 | + "- Table\n" |
| 89 | + ] |
| 90 | + }, |
| 91 | + { |
| 92 | + "cell_type": "code", |
| 93 | + "execution_count": null, |
| 94 | + "metadata": {}, |
| 95 | + "outputs": [], |
| 96 | + "source": [] |
| 97 | + } |
| 98 | + ], |
| 99 | + "metadata": { |
| 100 | + "kernelspec": { |
| 101 | + "display_name": "Python 3", |
| 102 | + "language": "python", |
| 103 | + "name": "python3" |
| 104 | + }, |
| 105 | + "language_info": { |
| 106 | + "codemirror_mode": { |
| 107 | + "name": "ipython", |
| 108 | + "version": 3 |
| 109 | + }, |
| 110 | + "file_extension": ".py", |
| 111 | + "mimetype": "text/x-python", |
| 112 | + "name": "python", |
| 113 | + "nbconvert_exporter": "python", |
| 114 | + "pygments_lexer": "ipython3", |
| 115 | + "version": "3.11.5" |
| 116 | + } |
| 117 | + }, |
| 118 | + "nbformat": 4, |
| 119 | + "nbformat_minor": 2 |
| 120 | +} |
0 commit comments