Coverage for docs_src / progressbar / tutorial002.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-11-18 11:12 +0000

1import time 1abcdefghij

2 

3import typer 1abcdefghij

4from rich.progress import Progress, SpinnerColumn, TextColumn 1abcdefghij

5 

6app = typer.Typer() 1abcdefghij

7 

8 

9@app.command() 1abcdefghij

10def main(): 1abcdefghij

11 with Progress( 1abcdefghij

12 SpinnerColumn(), 

13 TextColumn("[progress.description]{task.description}"), 

14 transient=True, 

15 ) as progress: 

16 progress.add_task(description="Processing...", total=None) 1abcdefghij

17 progress.add_task(description="Preparing...", total=None) 1abcdefghij

18 time.sleep(5) 1abcdefghij

19 print("Done!") 1abcdefghij

20 

21 

22if __name__ == "__main__": 1abcdefghij

23 app() 1abcdefghij