Augment the tqdm class with the ability to track progress of different categories.
Project description
Overview
This module extends tqdm's tqdm class with basic colored sub-progressbars.
Tested in VS Code on a Linux server. No guarantees for other use cases.
Great for ML/DL, to track training loops and evaluation progress. E.g. ballanced training with undersampling and confusion-matrix:
Installation
pip install colortqdm
Usage
Basic usage
Backwards compatible:
from colortqdm import colortqdm as ctqdm
import time
for _ in ctqdm(range(5000)):
time.sleep(0.001)
Known total:
from colortqdm import colortqdm as ctqdm
import time
import numpy as np
total = 5000
with ctqdm(total=total, desc="Known total") as pbar:
for i, p in enumerate(np.random.uniform(0,1,total)):
if p > i / total:
pbar.update(1, color="green")
else:
pbar.update(1, color="red")
time.sleep(0.001)
Unknown total:
from colortqdm import colortqdm as ctqdm
import time
import numpy as np
total = 5000
with ctqdm(total=None, desc="Unknown total") as pbar:
for i, p in enumerate(np.random.uniform(0,1,total)):
if p > i / total:
pbar.update(1, color="green")
else:
pbar.update(1, color="red")
time.sleep(0.001)
Available named colors
from colortqdm import colortqdm as ctqdm
import time
import numpy as np
total = 500
with ctqdm(total=total) as pbar:
x = np.random.randint(0,10,total)
for i in x:
if i == 0:
pbar.update(1, color="blue", name="blue")
elif i == 1:
pbar.update(1, color="orange", name="orange")
elif i == 2:
pbar.update(1, color="green", name="green")
elif i == 3:
pbar.update(1, color="red", name="red")
elif i == 4:
pbar.update(1, color="purple", name="purple")
elif i == 5:
pbar.update(1, color="brown", name="brown")
elif i == 6:
pbar.update(1, color="magenta", name="magenta")
elif i == 7:
pbar.update(1, color="grey", name="grey")
elif i == 8:
pbar.update(1, color="yellow", name="yellow")
else:
pbar.update(1) #default (white)
time.sleep(0.002)
Custom colors
from colortqdm import colortqdm as ctqdm
import time
import numpy as np
total = 500
with ctqdm(total=total, desc="Custom RGB") as pbar:
x = np.random.randint(0,4,total)
for i in x:
if i == 0:
pbar.update(1, color=(208,244,244))
elif i == 1:
pbar.update(1, color=(238,213,255))
elif i == 2:
pbar.update(1, color=(255,192,215))
else:
pbar.update(1, color=(255,249,193))
time.sleep(0.001)
License
This project is licensed under the MIT License (c) 2025 Bálint Csanády, aielte-research. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file colortqdm-0.0.1.tar.gz.
File metadata
- Download URL: colortqdm-0.0.1.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
264bff9d7947aa4e526b48eb125880afbf98ffd1f4f04a60da25f724b61d3d75
|
|
| MD5 |
0d1d522e5ad6910bb449b8d0d8aabfb9
|
|
| BLAKE2b-256 |
dbd4393a59a44d23039d82d913c3a010ac44c5c4aa270b5ab677919d0d512128
|
File details
Details for the file colortqdm-0.0.1-py3-none-any.whl.
File metadata
- Download URL: colortqdm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93678059378f051236d98c28a179153c9a119bf26d2f2d5e75153d707e2db73f
|
|
| MD5 |
35c2ccf6f390b509cd61319417d23115
|
|
| BLAKE2b-256 |
a719fb3f6058a2fa4d8b0d96008833d1fbd5e3a6abebaf78b32ef00ae9a93c17
|