You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-22Lines changed: 49 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,20 +38,20 @@ This README is always evolving, so do take a more comprehensive look from time t
38
38
<!-- TOC -->
39
39
*[alive-progress](#alive-progress)
40
40
*[Table of contents](#table-of-contents)
41
-
*[📌 What's new in 3.2 series](#-whats-new-in-32-series)
41
+
*[📌 What's new in 3.3 series](#-whats-new-in-33-series)
42
42
*[Previous releases](#previous-releases)
43
43
*[Using `alive-progress`](#using-alive-progress)
44
44
*[Get it](#get-it)
45
45
*[Try it](#try-it)
46
46
*[Awake it](#awake-it)
47
47
*[Master it](#master-it)
48
-
*[Displaying messages](#displaying-messages)
48
+
*[The `bar` handler](#the-bar-handler)
49
49
*[Auto-iterating](#auto-iterating)
50
50
*[Modes of operation](#modes-of-operation)
51
51
*[Auto and Unknown: Counter](#auto-and-unknown-counter)
52
52
*[Manual: Percentage](#manual-percentage)
53
53
*[Widgets available](#widgets-available)
54
-
*[The different `bar()`handlers](#the-different-bar-handlers)
54
+
*[The different `bar()`handler semantics](#the-different-bar-handler-semantics)
55
55
*[Styles](#styles)
56
56
*[Configuration](#configuration)
57
57
*[Create your own animations](#create-your-own-animations)
@@ -73,7 +73,27 @@ This README is always evolving, so do take a more comprehensive look from time t
73
73
*[License](#license)
74
74
<!-- TOC -->
75
75
76
-
## 📌 What's new in 3.2 series
76
+
## 📌 What's new in 3.3 series
77
+
78
+
The latest `alive-progress` release is finally here, and it brings some exciting improvements! 🎉
79
+
80
+
Here's a summary of the most notable changes:
81
+
82
+
- Now the final receipt is available in the alive_bar handle, even after the bar has finished!
83
+
- This allows you to access the final receipt data and use it in your code, such as logging or displaying it in a custom way.
84
+
- You can change the bar title and text even after it has finished, so you can update the final receipt with new information or context.
85
+
- Included the elapsed time in the alive_bar handle, with full precision, so you can access the exact time it took to complete your processing.
86
+
87
+
Technical changes:
88
+
89
+
- Changed the `grapheme` dependency which was no longer maintained to `graphemeu`, which is a maintained fork of the original one.
90
+
- Added `py.typed` in the distribution to satisfy mypy and other type checking tools.
91
+
- Included Python 3.14 support (in CI for now).
92
+
93
+
### Previous releases
94
+
95
+
<details>
96
+
<summary>New in 3.2 series</summary>
77
97
78
98
After about a year of reassuring stability, the new `alive-progress` has finally landed!
79
99
@@ -90,7 +110,7 @@ And more!
90
110
- Improved compatibility with Celery => it will just work within Celery tasks!
91
111
- drop python 3.7 and 3.8, hello 3.12 and 3.13!
92
112
93
-
### Previous releases
113
+
</details>
94
114
95
115
<details>
96
116
<summary>New in 3.1 series</summary>
@@ -372,27 +392,33 @@ So, in a nutshell: retrieve the items as always, enter the `alive_bar` context m
372
392
373
393
### Master it
374
394
375
-
-`items` can be any iterable, like for example, a queryset;
376
-
- the first argument of the `alive_bar` is the expected total, like `qs.count()` for querysets, `len(items)` for iterables with length, or even a static number;
377
-
- the call `bar()` is what makes the bar go forward — you usually call it in every iteration, just after finishing an item;
378
-
- if you call `bar()` too much (or too few at the end), the bar will graphically render that deviation from the expected `total`, making it very easy to notice overflows and underflows;
379
-
- to retrieve the current bar count or percentage, call `bar.current`.
395
+
- The `items` argument can be any iterable, like for example, a queryset.
396
+
- The first argument of the `alive_bar` is the expected total, like `qs.count()` for querysets, `len(items)` for bounded iterables, or even some static number.
397
+
- Calling `bar()` is what makes the bar go forward — you usually call it once in every iteration, just after finishing an item.
398
+
- If you call `bar()` too much or too few, the bar will graphically render that deviation from the expected `total`, making it very easy to notice under and overflows.
399
+
- The usual Python `print()` is automatically hooked, so you can effortlessly display messages tightly integrated with the current progress bar on display! It won't break the fast bar refreshes in any way and will even enrich your message! The bar nicely cleans up the line, prints the current bar position alongside your message, and continues refreshing right below it!
400
+
- The standard Python `logging` framework is also automatically hooked and enriched, exactly like the `print()` above!
401
+
- If you're using the `click` CLI lib, you can even use `click.echo()` to print styled text.
380
402
381
-
> You can get creative! Since the bar only goes forward when you call `bar()`, it is **independent of the loop**! So you can use it to monitor anything you want, like pending transactions, broken items, etc., or even call it more than once in the same iteration! So, in the end, you'll get to know how many of those "special" events there were, including their percentage relative to the total!
> You can get creative! Since the bar goes forward only when you call `bar()`, it is **independent of the loop** it is in! So you can use it to monitor unrelated things like pending transactions, broken items, etc., or even call it more than once in the same iteration! That way, you'll get to know how many of these "special" events there were, including their percentage relative to the total!
384
406
385
-
While inside an `alive_bar` context, you can effortlessly display messages tightly integrated with the current progress bar being displayed! It won't break in any way and will even enrich your message!
407
+
Awesome right? And everything work the same both in real terminals and in Jupyter notebooks!
386
408
387
-
- the cool `bar.text('message')` and `bar.text = 'message'` set a situational message right within the bar, where you can display something about the current item or the phase the processing is in;
388
-
- the (📌 new) dynamic title, which can be set right at the start, but also be changed anytime with `bar.title('Title')` and `bar.title = 'Title'` — mix with `title_length` to keep the bar from changing its length;
389
-
- the usual Python `print()` statement, where `alive_bar` nicely cleans up the line, prints your message alongside the current bar position at the time, and continues the bar right below it;
390
-
- the standard Python `logging` framework, including file outputs, is also enriched exactly like the previous one;
391
-
- if you're using click CLI lib, you can even use `click.echo()` to print styled text.
409
+
## The `bar` handler
392
410
393
-
Awesome right? And all of these work just the same in a terminal or in a Jupyter notebook!
411
+
After a bar has finished (or even while running), you have a plethora of methods available to grab information about the bar, and to control it. Here are they:
-`bar.text('message')` or `bar.text = 'message'`: set a situational message at the end of the bar, where you can display information about the current item or the phase the processing is in.
414
+
-`bar.title('Title')` or `bar.title = 'Title'`: set a title at the beginning of the bar; can be set right when starting it or while it's running or even after finished to affect the receipt on demand — mix it with `title_length` config to keep the bar from changing its length while running.
415
+
-`bar.current`: retrieve the current bar count or percentage — more details below on Modes of Operation.
416
+
-`bar.monitor` returns the current monitor widget text, which is the current bar position formatted according to the current configuration.
417
+
-`bar.eta`: returns the current ETA widget text, formatted according to the current configuration.
418
+
-`bar.rate`: returns the current throughput widget text, formatted according to the current configuration.
419
+
-`bar.elapsed`: returns the current elapsed time in seconds, with full precision.
420
+
-`bar.receipt`: returns an on-demand receipt, which can be used however you want in your code, such as logging or displaying it in a custom way.
421
+
-`bar.pause()`: pauses the bar without losing its state — more details below on the Pause Mechanism.
396
422
397
423
## Auto-iterating
398
424
@@ -479,7 +505,7 @@ But it's actually simple to understand: you do not need to think about which mod
479
505
480
506
That's it! It will just work the best it can! 👏 \o/
481
507
482
-
### The different `bar()`handlers
508
+
### The different `bar()`handler semantics
483
509
484
510
The `bar()` handlers support either relative or absolute semantics, depending on the mode:
485
511
@@ -498,7 +524,7 @@ In any case, to retrieve the current counter/percentage, just call: `bar.current
498
524
- in _auto_ and _unknown_ modes, this provides an **integer** — the actual internal counter;
499
525
- in _manual_ mode, this provides a **float** in the interval [0, 1] — the last percentage set.
500
526
501
-
Finally, the `bar()` handler leverages the **auto** mode unique ability: just call `bar(skipped=True)` or `bar(N, skipped=True)` to use it. When `skipped` is set to=`True`, the associated item(s) are excluded from throughput calculations, preventing skipped items from inaccurately affecting the ETA.
527
+
Finally, the `bar()` handler in **auto** mode leverages a unique ability: skip items! Just call `bar(skipped=True)` or `bar(10, skipped=True)` to exclude those items from the throughput calculations, and thus preventing them from inaccurately affecting the ETA.
502
528
503
529
---
504
530
Maintaining an open source project is hard and time-consuming, and I've put much ❤️ and effort into this.
@@ -934,6 +960,7 @@ You can also set it system-wide using `config_handler`, so you don't need to pas
- 3.3.0: new bar.receipt and bar.elapsed; allow changing bar title and text even after finished; use `graphemeu` dependency; add `py.typed`; include Python 3.14 support in CI
937
964
- 3.2.0: print/logging hooks now support multithreading, rounded ETAs for long tasks, support for zero and negative bar increments, custom offset for enriched print/logging messages, improved compatibility with PyInstaller and Celery, drop 3.7 and 3.8, hello 3.12 and 3.13
938
965
- 3.1.4: support spaces at the start and end of titles and units
939
966
- 3.1.3: better error handling of invalid `alive_it` calls, detect nested uses of alive_progress and throw a clearer error message
0 commit comments