Questions tagged [rich]

Rich is a Python library for rich text and beautiful formatting in the terminal.

99 questions
1
vote
0 answers

Python REPL inside a Rich Panel?

Motivation: I'm interacting with a complex piece of HW via a Data Acquisition (DAQ) system. I would like to send complex interactive debugging control sequences to the DUT while also seeing status in one or more Rich Live Panels. I would like to…
JS.
  • 14,781
  • 13
  • 63
  • 75
1
vote
0 answers

Using rich or textual to generate a grid like a chess board

I would like to know the efficient way to generate a grid (literal meaning) using rich or textual. I have noticed the rich.table package so yes I can generate a grid but I didn't find a way to change the background color of a single cell. But also,…
microchip
  • 81
  • 1
  • 6
1
vote
1 answer

How to format print statement using ANSI Codes using function?

I know I can do print(f"\033[32m{newDict[0][1]}\033[0m", f"\033[32m{newDict[1][1]}\033[0m") to print a dictionary value in color, But I'm putting that into a for loop inside a function and its output is weird and not the output for what I…
edwardvth
  • 41
  • 3
1
vote
1 answer

Change progress bar text when completing 100%

In this example the total progress is 5 seconds (I'm building a model that can be malleable, that I can use any amount of total seconds that will work the same): from rich.progress import Progress import time import sys def main(timeout): …
Digital Farmer
  • 1,705
  • 5
  • 17
  • 67
1
vote
0 answers

Jenkins - Console Output pretty formatting using RICH api

I recently started to use Rich API for python and it feels awesome. I was wondering if I could get it running somehow to emulate same results in jenkins console output. I was searching for more information on their github…
Andreii21
  • 11
  • 1
1
vote
2 answers

Reset a Table with Rich in Python, or delete a row?

How could I erase a row table in rich? (Erase the rows or reset all the table) ex. How could I reset tableTest or erase a row? from rich.console import Console from rich.table import Table tableTest = Table(title="Star Wars…
Todeshine
  • 13
  • 4
1
vote
1 answer

use rich module to create two colums in prompt

I'm making a small program that pick random people in a list (a proget for school). The code works fine: import numpy as np people = ["0 = Baiesi", "1 = Balducci", "2 = Bulgarelli", "3 = Caffaggi", "4 = Caprara", "5 = Dodi", "6 = Fattore", "7 =…
Edoardo Balducci
  • 332
  • 1
  • 10
1
vote
1 answer

How to use custom log handler in pytest

I would like to use rich.logging.RichHandler from the rich library to handle all captured logs in pytest. Say I have two files, # library.py import logging logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) def func(): …
rolly
  • 145
  • 9
1
vote
0 answers

Can't Import Rich Python Libary

SOLVED I'm trying to import the rich python library into my script, but it isn't working. I was able to install it with pip install rich but my script doesn't seem to recognize it as being installed. To make sure it was installed I ran python -m…
1
vote
1 answer

Python Rich: Emojis not showing

from rich import print from rich.console import Console console = Console() #example 1 print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals()) #example 2 console = Console() print("Hello, [bold magenta]World[/bold magenta]!",…
Hrushal
  • 45
  • 1
  • 9
1
vote
1 answer

(Python/rich) restore cursor default values on exit

I have a Python3.9+ project that runs on the command line on both Linux and Windows. I use rich to interact with the console. Out of curiosity I would like to know if it is possible to save the characteristics of the console cursor at the beginning…
suizokukan
  • 1,303
  • 4
  • 18
  • 33
1
vote
1 answer

Rich Inspect Discovery

Im trying to dig into the Rich inpsect further to understand how it is doing the following. If I look at an object (result) like so. I can see that it has the following attributes and methods. >>> vars(result) {'name': 'hello_world'} >>>…
felix001
  • 15,341
  • 32
  • 94
  • 121
1
vote
0 answers

python custom logging fomatter using rich

I'm trying to add a richFormatter() to my existing logging stack, but how can I get it to fit my own logging format: and not wrap the default richLogger outside of it? #!/usr/bin/env python3 import logging from operator import truediv from…
MortenB
  • 2,749
  • 1
  • 31
  • 35
1
vote
1 answer

logging for multi-module program

I want to add a logging mechanism to my program. The basic structure of my project directory is so: . ├── README.md └── src ├── cli.py ├── module1.py ├── module2.py └── module3.py cli.py imports all other module[1-3].py, but, I also…
Yair
  • 58
  • 6
1
vote
1 answer

rich.table Returning Incorrect Number of Results

I'm scraping movie information by year. When I try print statement it prints all 100 movies, but when I use rich.table print I get only first movie. import requests from bs4 import BeautifulSoup from rich.table import Table from rich.console import…