Skip to main content

Log and progress bar manager for console, notebooks, web...

Project description

https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Proglog/master/logo.png

Proglog is a simple logging system for Python. It allows to build complex libraries while giving the user control on the management of logs and progress bars.

What problem does it solve ?

The simplest way to get progress bars in python is with tqdm

from tqdm import tqdm
for i in tqdm(range(10000)):
  ...
76%|████████████████████████████         | 7568/10000 [00:33<00:10, 229.00it/s]

While this is great for quick scripts, it works less well when you want to:

  • Log more than just progress bars, for instance pictures, text, or any python object.

  • Selectively mute some progress bars.

  • Let your project’s users customize the way the logs and progress bars are handled, for instance to send the progress over to some webclient instead of the console.

Proglog solves this by sending the logs to any backend, such as tqdm, or some web database. You can change where the data is sent just by using a different logger class, without modification of your core code.

It does so by having a single logger used everywhere in your project:

logger = TqdmProgressBarLogger()
for i in logger.iter_bar(main=range(10)):
    for j in logger.iter_bar(sub=range(10)):
        ... do suff here
    if i == 3:
        logger(message="We just passed i=3")
We just passed i=3
main:  50%|████████████▌            | 5/10 [00:04<00:04,  1.20it/s]
sub:  100%|████████████████████████| 10/10 [00:00<00:00, 10.26it/s]

Now the complete logging behaviour can be customized by modifying the logger definition, for instance TqdmProgressBarLogger(ignored_bars=['sub']) to mute the sub bar, or logger=RqWorkerBarLogger(job=some_rq_job) to update the status of a python-rq asynchronous job.

Installation

You can install Proglog through PIP

sudo pip install proglog

Alternatively, you can unzip the sources in a folder and type

sudo python setup.py install

To use the tqdm notebook-style progress bars you need to install and enable iwidgets:

sudo pip install ipywidgets
sudo jupyter nbextension enable --py --sys-prefix widgetsnbextension

Licence

Proglog is an open-source software originally written at the Edinburgh Genome Foundry by Zulko and released on Github under the MIT licence (copyright Edinburgh Genome Foundry). Everyone is welcome to contribute !

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proglog-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file proglog-0.1.0.tar.gz.

File metadata

  • Download URL: proglog-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for proglog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 791ef6ad12000c58bba2fd114eb323cbbd0c060b54d54f6eb7fc4eaf9c1e21c5
MD5 b0e756e6e5fba1923d8c7b008a44a182
BLAKE2b-256 0265e21e39f4b8f14db2ce6e3c4c1a511caafc3140e0d6440469596c94a45f31

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page