File: tutorial006.py

package info (click to toggle)
typer 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,224 kB
  • sloc: python: 9,958; javascript: 272; sh: 63; makefile: 19
file content (17 lines) | stat: -rw-r--r-- 336 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import time

import typer


def main():
    total = 1000
    with typer.progressbar(length=total) as progress:
        for batch in range(4):
            # Fake processing time
            time.sleep(1)
            progress.update(250)
    print(f"Processed {total} things in batches.")


if __name__ == "__main__":
    typer.run(main)