rich-logger
Table logger using Rich, aimed at Pytorch Lightning logging
Features
- display your training logs with pretty rich tables
- describe your fields with
goal("higher_is_better" or "lower_is_better"),formatandname - a field descriptor can be matched with any regex
- a field name can be computed as a regex substitution
- works in Jupyter notebooks as well as in a command line
- integrates easily with Pytorch Lightning
Demo
from rich_logger import RichTablePrinter
import time
import random
from tqdm import trange
logger_fields = {
"step": {},
"(.*)_precision": {
"goal": "higher_is_better",
"format": "{:.4f}",
"name": r"\1_p",
},
"(.*)_recall": {
"goal": "higher_is_better",
"format": "{:.4f}",
"name": r"\1_r",
},
"duration": {"format": "{:.1f}", "name": "dur(s)"},
".*": True, # Any other field must be logged at the end
}
def optimization():
printer = RichTablePrinter(key="step", fields=logger_fields)
printer.hijack_tqdm()
t = time.time()
for i in trange(10):
time.sleep(random.random() / 3)
printer.log(
{
"step": i,
"task_precision": i / 10.0 if i < 5 else 0.5 - (i - 5) / 10.0,
}
)
time.sleep(random.random() / 3)
printer.log(
{
"step": i,
"task_recall": 0.0 if i < 3 else (i - 3) / 10.0,
"duration": time.time() - t,
}
)
printer.log({"test": i})
t = time.time()
for j in trange(5):
time.sleep(random.random() / 10)
printer.finalize()
optimization()
Use it with PytorchLightning
from rich_logger import RichTableLogger
trainer = pl.Trainer(..., logger=[RichTableLogger(key="epoch", fields=logger_fields)])
Release files for rich-logger 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rich_logger-0.3.2.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rich_logger-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.4 kB
Release files / rich_logger-0.3.2.tar.gz
| Download URL | rich_logger-0.3.2.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d8c1c7025dfc21fef6989c11103fb5af12dc2bde9671ddcd2148b255185876d
|
|
BLAKE2b-256 checksum How to use checksums |
5c879f87ce175c3e72df8acb477c71d53728f1db6cb64c4bf0e47265785bdab4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2025.
Transparency logRelease files / rich_logger-0.3.2-py3-none-any.whl
| Download URL | rich_logger-0.3.2-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68f5882d8aa13d01e494740369e409a0a2b4e54ea033e65c7bcd8b236a1e89b7
|
|
BLAKE2b-256 checksum How to use checksums |
7d35bad957fd994ffa89fbabeef31110717741ff2c4ac450b006632fee0b3dad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2025.
Transparency log