tqdm-styles 1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tqdm_styles-1.0/LICENSE +21 -0
- tqdm_styles-1.0/PKG-INFO +248 -0
- tqdm_styles-1.0/README.md +226 -0
- tqdm_styles-1.0/pyproject.toml +38 -0
- tqdm_styles-1.0/setup.cfg +4 -0
- tqdm_styles-1.0/tqdm_styles/__init__.py +17 -0
- tqdm_styles-1.0/tqdm_styles/__init__.pyi +198 -0
- tqdm_styles-1.0/tqdm_styles/styles.py +84 -0
- tqdm_styles-1.0/tqdm_styles.egg-info/PKG-INFO +248 -0
- tqdm_styles-1.0/tqdm_styles.egg-info/SOURCES.txt +11 -0
- tqdm_styles-1.0/tqdm_styles.egg-info/dependency_links.txt +1 -0
- tqdm_styles-1.0/tqdm_styles.egg-info/requires.txt +1 -0
- tqdm_styles-1.0/tqdm_styles.egg-info/top_level.txt +1 -0
tqdm_styles-1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 IgorNk500
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tqdm_styles-1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tqdm-styles
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: Some progress bar presets (styles) for TQDM
|
|
5
|
+
Author-email: IgorNk500 <igornk500@outlook.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/IgorNk500/tqdm-styles
|
|
8
|
+
Project-URL: Documentation, https://github.com/IgorNk500/tqdm-styles/wiki
|
|
9
|
+
Project-URL: Repository, https://github.com/IgorNk500/tqdm-styles
|
|
10
|
+
Project-URL: Issues, https://github.com/IgorNk500/tqdm-styles/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/IgorNk500/tqdm-styles/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: tqdmstyles,styles-tqdm,stylestqdm
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Development Status :: 1 - Planning
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Requires-Python: >=3.10.0
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: tqdm
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
<div align="center">
|
|
24
|
+
<img src="https://raw.githubusercontent.com/tqdm/tqdm/refs/heads/master/images/logo.gif" alt="TQDM logo">
|
|
25
|
+
<br/>
|
|
26
|
+
<br/>
|
|
27
|
+
<a href="https://github.com/IgorNk500/tqdm-styles/actions/workflows/release_build.yml"><img src="https://github.com/IgorNk500/tqdm-styles/actions/workflows/release_build.yml/badge.svg" alt="Package build"></a>
|
|
28
|
+
<a href="https://github.com/IgorNk500/tqdm-styles/actions/workflows/pylint.yml"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/IgorNk500/8968adb8b6d3e6f1759c69835be871b5/raw/pylint.json" alt="PyLint lint"></a>
|
|
29
|
+
<br/>
|
|
30
|
+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/pypi/pyversions/tqdm-styles" alt="Supported python versions"></a>
|
|
31
|
+
<a href="https://github.com/IgorNk500/tqdm-styles"><img src="https://img.shields.io/badge/github-repo-blue?logo=github" alt="Github repository"></a>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
***
|
|
35
|
+
|
|
36
|
+
# TQDM Styles
|
|
37
|
+
### Some progress bar presets (styles) for [TQDM Python library](https://pypi.org/project/tqdm/)
|
|
38
|
+
###### *[(Go to changelog)](CHANGELOG.md)*
|
|
39
|
+
|
|
40
|
+
## Table of contents
|
|
41
|
+
1. [Installing](#installing)
|
|
42
|
+
2. [Styles](#styles)
|
|
43
|
+
3. [Usage](#usage)
|
|
44
|
+
4. [Build](#build)
|
|
45
|
+
5. [Workflows](#workflows)
|
|
46
|
+
|
|
47
|
+
## Installing
|
|
48
|
+
```bash
|
|
49
|
+
python -m pip install -U tqdm tqdm-styles
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Styles
|
|
53
|
+
| **Style name** | Style ID in [`style` param](#or-use-one-function-with-style-parameter) | Description |
|
|
54
|
+
|------------------|------------------------------------------------------------------------|-----------------------------|
|
|
55
|
+
| **Neon** | `neon` | Neon style |
|
|
56
|
+
| **Modern** | `modern` | Modern style |
|
|
57
|
+
| **Retro** | `retro` | Retro style |
|
|
58
|
+
| **Compact** | `compact` | Compact (without bar) style |
|
|
59
|
+
| **Minimalistic** | `minimalistic` | Minimalistic (dot) style |
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
### You can call styles separately...:
|
|
63
|
+
```python
|
|
64
|
+
from tqdm_styles import tqdm_neon
|
|
65
|
+
from tqdm_styles import tqdm_modern
|
|
66
|
+
from tqdm_styles import tqdm_retro
|
|
67
|
+
from tqdm_styles import tqdm_compact
|
|
68
|
+
from tqdm_styles import tqdm_minimalistic
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### ...Or use one function with `style` parameter:
|
|
72
|
+
```python
|
|
73
|
+
def tqdm(iterable: Iterable[_T],
|
|
74
|
+
desc: str | None = None,
|
|
75
|
+
total: float | None = None,
|
|
76
|
+
leave: bool | None = True,
|
|
77
|
+
file: SupportsWrite[str] | None = None,
|
|
78
|
+
ncols: int | None = None,
|
|
79
|
+
mininterval: float = 0.1,
|
|
80
|
+
maxinterval: float = 10.0,
|
|
81
|
+
miniters: float | None = None,
|
|
82
|
+
ascii: bool | str | None = None,
|
|
83
|
+
disable: bool | None = False,
|
|
84
|
+
unit: str = "it",
|
|
85
|
+
unit_scale: bool | float = False,
|
|
86
|
+
dynamic_ncols: bool = False,
|
|
87
|
+
smoothing: float = 0.3,
|
|
88
|
+
bar_format: str | None = None,
|
|
89
|
+
initial: float = 0,
|
|
90
|
+
position: int | None = None,
|
|
91
|
+
postfix: Mapping[str, object] | str | None = None,
|
|
92
|
+
unit_divisor: float = 1000,
|
|
93
|
+
write_bytes: bool = False,
|
|
94
|
+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = None,
|
|
95
|
+
nrows: int | None = None,
|
|
96
|
+
colour: str | None = None,
|
|
97
|
+
delay: float | None = 0,
|
|
98
|
+
gui: bool = False,
|
|
99
|
+
style: str = "default",
|
|
100
|
+
**kwargs) -> _tqdm:
|
|
101
|
+
"""TQDM bar stylization. It is a function and returns TQDM object.
|
|
102
|
+
|
|
103
|
+
Styles
|
|
104
|
+
----------
|
|
105
|
+
**Neon** - `neon` - Neon style\n
|
|
106
|
+
**Modern** - `modern` - Modern style\n
|
|
107
|
+
**Retro** - `retro` - Retro style\n
|
|
108
|
+
**Compact** - `compact` - Compact (without bar) style\n
|
|
109
|
+
**Minimalistic** - `minimalistic` - Minimalistic (dot) style\n
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
iterable : iterable, optional
|
|
114
|
+
Iterable to decorate with a progress bar.
|
|
115
|
+
Leave blank to manually manage the updates.
|
|
116
|
+
desc : str, optional
|
|
117
|
+
Prefix for the progress bar.
|
|
118
|
+
total : int or float, optional
|
|
119
|
+
The number of expected iterations. If unspecified,
|
|
120
|
+
len(iterable) is used if possible. If float("inf") or as a last
|
|
121
|
+
resort, only basic progress statistics are displayed
|
|
122
|
+
(no ETA, no progress bar).
|
|
123
|
+
If `gui` is True and this parameter needs subsequent updating,
|
|
124
|
+
specify an initial arbitrary large positive number,
|
|
125
|
+
e.g. 9e9.
|
|
126
|
+
leave : bool, optional
|
|
127
|
+
If [default: True], keeps all traces of the progress bar
|
|
128
|
+
upon termination of iteration.
|
|
129
|
+
If `None`, will leave only if `position` is `0`.
|
|
130
|
+
file : `io.TextIOWrapper` or `io.StringIO`, optional
|
|
131
|
+
Specifies where to output the progress messages
|
|
132
|
+
(default: sys.stderr). Uses `file.write(str)` and `file.flush()`
|
|
133
|
+
methods. For encoding, see `write_bytes`.
|
|
134
|
+
ncols : int, optional
|
|
135
|
+
The width of the entire output message. If specified,
|
|
136
|
+
dynamically resizes the progress bar to stay within this bound.
|
|
137
|
+
If unspecified, attempts to use environment width. The
|
|
138
|
+
fallback is a meter width of 10 and no limit for the counter and
|
|
139
|
+
statistics. If 0, will not print any meter (only stats).
|
|
140
|
+
mininterval : float, optional
|
|
141
|
+
Minimum progress display update interval [default: 0.1] seconds.
|
|
142
|
+
maxinterval : float, optional
|
|
143
|
+
Maximum progress display update interval [default: 10] seconds.
|
|
144
|
+
Automatically adjusts `miniters` to correspond to `mininterval`
|
|
145
|
+
after long display update lag. Only works if `dynamic_miniters`
|
|
146
|
+
or monitor thread is enabled.
|
|
147
|
+
miniters : int or float, optional
|
|
148
|
+
Minimum progress display update interval, in iterations.
|
|
149
|
+
If 0 and `dynamic_miniters`, will automatically adjust to equal
|
|
150
|
+
`mininterval` (more CPU efficient, good for tight loops).
|
|
151
|
+
If > 0, will skip display of specified number of iterations.
|
|
152
|
+
Tweak this and `mininterval` to get very efficient loops.
|
|
153
|
+
If your progress is erratic with both fast and slow iterations
|
|
154
|
+
(network, skipping items, etc) you should set miniters=1.
|
|
155
|
+
ascii : bool or str, optional
|
|
156
|
+
If unspecified or False, use unicode (smooth blocks) to fill
|
|
157
|
+
the meter. The fallback is to use ASCII characters " 123456789#".
|
|
158
|
+
disable : bool, optional
|
|
159
|
+
Whether to disable the entire progress bar wrapper
|
|
160
|
+
[default: False]. If set to None, disable on non-TTY.
|
|
161
|
+
unit : str, optional
|
|
162
|
+
String that will be used to define the unit of each iteration
|
|
163
|
+
[default: it].
|
|
164
|
+
unit_scale : bool or int or float, optional
|
|
165
|
+
If 1 or True, the number of iterations will be reduced/scaled
|
|
166
|
+
automatically and a metric prefix following the
|
|
167
|
+
International System of Units standard will be added
|
|
168
|
+
(kilo, mega, etc.) [default: False]. If any other non-zero
|
|
169
|
+
number, will scale `total` and `n`.
|
|
170
|
+
dynamic_ncols : bool, optional
|
|
171
|
+
If set, constantly alters `ncols` and `nrows` to the
|
|
172
|
+
environment (allowing for window resizes) [default: False].
|
|
173
|
+
smoothing : float, optional
|
|
174
|
+
Exponential moving average smoothing factor for speed estimates
|
|
175
|
+
(ignored in GUI mode). Ranges from 0 (average speed) to 1
|
|
176
|
+
(current/instantaneous speed) [default: 0.3].
|
|
177
|
+
bar_format : str, optional
|
|
178
|
+
Specify a custom bar string formatting. May impact performance.
|
|
179
|
+
[default: '{l_bar}{bar}{r_bar}'], where
|
|
180
|
+
l_bar='{desc}: {percentage:3.0f}%|' and
|
|
181
|
+
r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, '
|
|
182
|
+
'{rate_fmt}{postfix}]'
|
|
183
|
+
Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,
|
|
184
|
+
percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,
|
|
185
|
+
rate, rate_fmt, rate_noinv, rate_noinv_fmt,
|
|
186
|
+
rate_inv, rate_inv_fmt, postfix, unit_divisor,
|
|
187
|
+
remaining, remaining_s, eta.
|
|
188
|
+
Note that a trailing ": " is automatically removed after {desc}
|
|
189
|
+
if the latter is empty.
|
|
190
|
+
initial : int or float, optional
|
|
191
|
+
The initial counter value. Useful when restarting a progress
|
|
192
|
+
bar [default: 0]. If using float, consider specifying `{n:.3f}`
|
|
193
|
+
or similar in `bar_format`, or specifying `unit_scale`.
|
|
194
|
+
position : int, optional
|
|
195
|
+
Specify the line offset to print this bar (starting from 0)
|
|
196
|
+
Automatic if unspecified.
|
|
197
|
+
Useful to manage multiple bars at once (eg, from threads).
|
|
198
|
+
postfix : dict or *, optional
|
|
199
|
+
Specify additional stats to display at the end of the bar.
|
|
200
|
+
Calls `set_postfix(**postfix)` if possible (dict).
|
|
201
|
+
unit_divisor : float, optional
|
|
202
|
+
[default: 1000], ignored unless `unit_scale` is True.
|
|
203
|
+
write_bytes : bool, optional
|
|
204
|
+
Whether to write bytes. If (default: False) will write unicode.
|
|
205
|
+
lock_args : tuple, optional
|
|
206
|
+
Passed to `refresh` for intermediate output
|
|
207
|
+
(initialisation, iterating, and updating).
|
|
208
|
+
nrows : int, optional
|
|
209
|
+
The screen height. If specified, hides nested bars outside this
|
|
210
|
+
bound. If unspecified, attempts to use environment height.
|
|
211
|
+
The fallback is 20.
|
|
212
|
+
colour : str, optional
|
|
213
|
+
Bar colour (e.g. 'green', '#00ff00').
|
|
214
|
+
delay : float, optional
|
|
215
|
+
Don't display until [default: 0] seconds have elapsed.
|
|
216
|
+
gui : bool, optional
|
|
217
|
+
WARNING: internal parameter - do not use.
|
|
218
|
+
Use tqdm.gui.tqdm(...) instead. If set, will attempt to use
|
|
219
|
+
matplotlib animations for a graphical output [default: False].
|
|
220
|
+
style : str, optional
|
|
221
|
+
TQDM style (default, neon, modern, retro, compact, minimalistic). Set `default` for use normal tqdm (`tqdm.tqdm`)
|
|
222
|
+
|
|
223
|
+
Returns
|
|
224
|
+
-------
|
|
225
|
+
TQDM iterable object (`tqdm.tqdm`)
|
|
226
|
+
"""
|
|
227
|
+
...
|
|
228
|
+
```
|
|
229
|
+
*P.S.: DocString part and other arguments of the function are copied from `tqdm/std.py`*
|
|
230
|
+
|
|
231
|
+
## Build
|
|
232
|
+
### To build the package, run:
|
|
233
|
+
```bash
|
|
234
|
+
python -m pip install build
|
|
235
|
+
python -m build .
|
|
236
|
+
```
|
|
237
|
+
Don't forget to change the config in the `pyproject.toml` file before doing this.\
|
|
238
|
+
**All distributions are stored in the `dist` folder**
|
|
239
|
+
|
|
240
|
+
## Workflows
|
|
241
|
+
**This project contains one workflow that:**
|
|
242
|
+
+ collects the wheel library,
|
|
243
|
+
+ adds it to the release files,
|
|
244
|
+
+ and uploads the release to PyPi.
|
|
245
|
+
|
|
246
|
+
**Also, project contains pytest and pylint workflows**
|
|
247
|
+
|
|
248
|
+
## If you encounter any errors, please open [issue](https://github.com/IgorNk500/tqdm-styles/issues/new "New issue") on GitHub.
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/tqdm/tqdm/refs/heads/master/images/logo.gif" alt="TQDM logo">
|
|
3
|
+
<br/>
|
|
4
|
+
<br/>
|
|
5
|
+
<a href="https://github.com/IgorNk500/tqdm-styles/actions/workflows/release_build.yml"><img src="https://github.com/IgorNk500/tqdm-styles/actions/workflows/release_build.yml/badge.svg" alt="Package build"></a>
|
|
6
|
+
<a href="https://github.com/IgorNk500/tqdm-styles/actions/workflows/pylint.yml"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/IgorNk500/8968adb8b6d3e6f1759c69835be871b5/raw/pylint.json" alt="PyLint lint"></a>
|
|
7
|
+
<br/>
|
|
8
|
+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/pypi/pyversions/tqdm-styles" alt="Supported python versions"></a>
|
|
9
|
+
<a href="https://github.com/IgorNk500/tqdm-styles"><img src="https://img.shields.io/badge/github-repo-blue?logo=github" alt="Github repository"></a>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
***
|
|
13
|
+
|
|
14
|
+
# TQDM Styles
|
|
15
|
+
### Some progress bar presets (styles) for [TQDM Python library](https://pypi.org/project/tqdm/)
|
|
16
|
+
###### *[(Go to changelog)](CHANGELOG.md)*
|
|
17
|
+
|
|
18
|
+
## Table of contents
|
|
19
|
+
1. [Installing](#installing)
|
|
20
|
+
2. [Styles](#styles)
|
|
21
|
+
3. [Usage](#usage)
|
|
22
|
+
4. [Build](#build)
|
|
23
|
+
5. [Workflows](#workflows)
|
|
24
|
+
|
|
25
|
+
## Installing
|
|
26
|
+
```bash
|
|
27
|
+
python -m pip install -U tqdm tqdm-styles
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Styles
|
|
31
|
+
| **Style name** | Style ID in [`style` param](#or-use-one-function-with-style-parameter) | Description |
|
|
32
|
+
|------------------|------------------------------------------------------------------------|-----------------------------|
|
|
33
|
+
| **Neon** | `neon` | Neon style |
|
|
34
|
+
| **Modern** | `modern` | Modern style |
|
|
35
|
+
| **Retro** | `retro` | Retro style |
|
|
36
|
+
| **Compact** | `compact` | Compact (without bar) style |
|
|
37
|
+
| **Minimalistic** | `minimalistic` | Minimalistic (dot) style |
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
### You can call styles separately...:
|
|
41
|
+
```python
|
|
42
|
+
from tqdm_styles import tqdm_neon
|
|
43
|
+
from tqdm_styles import tqdm_modern
|
|
44
|
+
from tqdm_styles import tqdm_retro
|
|
45
|
+
from tqdm_styles import tqdm_compact
|
|
46
|
+
from tqdm_styles import tqdm_minimalistic
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### ...Or use one function with `style` parameter:
|
|
50
|
+
```python
|
|
51
|
+
def tqdm(iterable: Iterable[_T],
|
|
52
|
+
desc: str | None = None,
|
|
53
|
+
total: float | None = None,
|
|
54
|
+
leave: bool | None = True,
|
|
55
|
+
file: SupportsWrite[str] | None = None,
|
|
56
|
+
ncols: int | None = None,
|
|
57
|
+
mininterval: float = 0.1,
|
|
58
|
+
maxinterval: float = 10.0,
|
|
59
|
+
miniters: float | None = None,
|
|
60
|
+
ascii: bool | str | None = None,
|
|
61
|
+
disable: bool | None = False,
|
|
62
|
+
unit: str = "it",
|
|
63
|
+
unit_scale: bool | float = False,
|
|
64
|
+
dynamic_ncols: bool = False,
|
|
65
|
+
smoothing: float = 0.3,
|
|
66
|
+
bar_format: str | None = None,
|
|
67
|
+
initial: float = 0,
|
|
68
|
+
position: int | None = None,
|
|
69
|
+
postfix: Mapping[str, object] | str | None = None,
|
|
70
|
+
unit_divisor: float = 1000,
|
|
71
|
+
write_bytes: bool = False,
|
|
72
|
+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = None,
|
|
73
|
+
nrows: int | None = None,
|
|
74
|
+
colour: str | None = None,
|
|
75
|
+
delay: float | None = 0,
|
|
76
|
+
gui: bool = False,
|
|
77
|
+
style: str = "default",
|
|
78
|
+
**kwargs) -> _tqdm:
|
|
79
|
+
"""TQDM bar stylization. It is a function and returns TQDM object.
|
|
80
|
+
|
|
81
|
+
Styles
|
|
82
|
+
----------
|
|
83
|
+
**Neon** - `neon` - Neon style\n
|
|
84
|
+
**Modern** - `modern` - Modern style\n
|
|
85
|
+
**Retro** - `retro` - Retro style\n
|
|
86
|
+
**Compact** - `compact` - Compact (without bar) style\n
|
|
87
|
+
**Minimalistic** - `minimalistic` - Minimalistic (dot) style\n
|
|
88
|
+
|
|
89
|
+
Parameters
|
|
90
|
+
----------
|
|
91
|
+
iterable : iterable, optional
|
|
92
|
+
Iterable to decorate with a progress bar.
|
|
93
|
+
Leave blank to manually manage the updates.
|
|
94
|
+
desc : str, optional
|
|
95
|
+
Prefix for the progress bar.
|
|
96
|
+
total : int or float, optional
|
|
97
|
+
The number of expected iterations. If unspecified,
|
|
98
|
+
len(iterable) is used if possible. If float("inf") or as a last
|
|
99
|
+
resort, only basic progress statistics are displayed
|
|
100
|
+
(no ETA, no progress bar).
|
|
101
|
+
If `gui` is True and this parameter needs subsequent updating,
|
|
102
|
+
specify an initial arbitrary large positive number,
|
|
103
|
+
e.g. 9e9.
|
|
104
|
+
leave : bool, optional
|
|
105
|
+
If [default: True], keeps all traces of the progress bar
|
|
106
|
+
upon termination of iteration.
|
|
107
|
+
If `None`, will leave only if `position` is `0`.
|
|
108
|
+
file : `io.TextIOWrapper` or `io.StringIO`, optional
|
|
109
|
+
Specifies where to output the progress messages
|
|
110
|
+
(default: sys.stderr). Uses `file.write(str)` and `file.flush()`
|
|
111
|
+
methods. For encoding, see `write_bytes`.
|
|
112
|
+
ncols : int, optional
|
|
113
|
+
The width of the entire output message. If specified,
|
|
114
|
+
dynamically resizes the progress bar to stay within this bound.
|
|
115
|
+
If unspecified, attempts to use environment width. The
|
|
116
|
+
fallback is a meter width of 10 and no limit for the counter and
|
|
117
|
+
statistics. If 0, will not print any meter (only stats).
|
|
118
|
+
mininterval : float, optional
|
|
119
|
+
Minimum progress display update interval [default: 0.1] seconds.
|
|
120
|
+
maxinterval : float, optional
|
|
121
|
+
Maximum progress display update interval [default: 10] seconds.
|
|
122
|
+
Automatically adjusts `miniters` to correspond to `mininterval`
|
|
123
|
+
after long display update lag. Only works if `dynamic_miniters`
|
|
124
|
+
or monitor thread is enabled.
|
|
125
|
+
miniters : int or float, optional
|
|
126
|
+
Minimum progress display update interval, in iterations.
|
|
127
|
+
If 0 and `dynamic_miniters`, will automatically adjust to equal
|
|
128
|
+
`mininterval` (more CPU efficient, good for tight loops).
|
|
129
|
+
If > 0, will skip display of specified number of iterations.
|
|
130
|
+
Tweak this and `mininterval` to get very efficient loops.
|
|
131
|
+
If your progress is erratic with both fast and slow iterations
|
|
132
|
+
(network, skipping items, etc) you should set miniters=1.
|
|
133
|
+
ascii : bool or str, optional
|
|
134
|
+
If unspecified or False, use unicode (smooth blocks) to fill
|
|
135
|
+
the meter. The fallback is to use ASCII characters " 123456789#".
|
|
136
|
+
disable : bool, optional
|
|
137
|
+
Whether to disable the entire progress bar wrapper
|
|
138
|
+
[default: False]. If set to None, disable on non-TTY.
|
|
139
|
+
unit : str, optional
|
|
140
|
+
String that will be used to define the unit of each iteration
|
|
141
|
+
[default: it].
|
|
142
|
+
unit_scale : bool or int or float, optional
|
|
143
|
+
If 1 or True, the number of iterations will be reduced/scaled
|
|
144
|
+
automatically and a metric prefix following the
|
|
145
|
+
International System of Units standard will be added
|
|
146
|
+
(kilo, mega, etc.) [default: False]. If any other non-zero
|
|
147
|
+
number, will scale `total` and `n`.
|
|
148
|
+
dynamic_ncols : bool, optional
|
|
149
|
+
If set, constantly alters `ncols` and `nrows` to the
|
|
150
|
+
environment (allowing for window resizes) [default: False].
|
|
151
|
+
smoothing : float, optional
|
|
152
|
+
Exponential moving average smoothing factor for speed estimates
|
|
153
|
+
(ignored in GUI mode). Ranges from 0 (average speed) to 1
|
|
154
|
+
(current/instantaneous speed) [default: 0.3].
|
|
155
|
+
bar_format : str, optional
|
|
156
|
+
Specify a custom bar string formatting. May impact performance.
|
|
157
|
+
[default: '{l_bar}{bar}{r_bar}'], where
|
|
158
|
+
l_bar='{desc}: {percentage:3.0f}%|' and
|
|
159
|
+
r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, '
|
|
160
|
+
'{rate_fmt}{postfix}]'
|
|
161
|
+
Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,
|
|
162
|
+
percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,
|
|
163
|
+
rate, rate_fmt, rate_noinv, rate_noinv_fmt,
|
|
164
|
+
rate_inv, rate_inv_fmt, postfix, unit_divisor,
|
|
165
|
+
remaining, remaining_s, eta.
|
|
166
|
+
Note that a trailing ": " is automatically removed after {desc}
|
|
167
|
+
if the latter is empty.
|
|
168
|
+
initial : int or float, optional
|
|
169
|
+
The initial counter value. Useful when restarting a progress
|
|
170
|
+
bar [default: 0]. If using float, consider specifying `{n:.3f}`
|
|
171
|
+
or similar in `bar_format`, or specifying `unit_scale`.
|
|
172
|
+
position : int, optional
|
|
173
|
+
Specify the line offset to print this bar (starting from 0)
|
|
174
|
+
Automatic if unspecified.
|
|
175
|
+
Useful to manage multiple bars at once (eg, from threads).
|
|
176
|
+
postfix : dict or *, optional
|
|
177
|
+
Specify additional stats to display at the end of the bar.
|
|
178
|
+
Calls `set_postfix(**postfix)` if possible (dict).
|
|
179
|
+
unit_divisor : float, optional
|
|
180
|
+
[default: 1000], ignored unless `unit_scale` is True.
|
|
181
|
+
write_bytes : bool, optional
|
|
182
|
+
Whether to write bytes. If (default: False) will write unicode.
|
|
183
|
+
lock_args : tuple, optional
|
|
184
|
+
Passed to `refresh` for intermediate output
|
|
185
|
+
(initialisation, iterating, and updating).
|
|
186
|
+
nrows : int, optional
|
|
187
|
+
The screen height. If specified, hides nested bars outside this
|
|
188
|
+
bound. If unspecified, attempts to use environment height.
|
|
189
|
+
The fallback is 20.
|
|
190
|
+
colour : str, optional
|
|
191
|
+
Bar colour (e.g. 'green', '#00ff00').
|
|
192
|
+
delay : float, optional
|
|
193
|
+
Don't display until [default: 0] seconds have elapsed.
|
|
194
|
+
gui : bool, optional
|
|
195
|
+
WARNING: internal parameter - do not use.
|
|
196
|
+
Use tqdm.gui.tqdm(...) instead. If set, will attempt to use
|
|
197
|
+
matplotlib animations for a graphical output [default: False].
|
|
198
|
+
style : str, optional
|
|
199
|
+
TQDM style (default, neon, modern, retro, compact, minimalistic). Set `default` for use normal tqdm (`tqdm.tqdm`)
|
|
200
|
+
|
|
201
|
+
Returns
|
|
202
|
+
-------
|
|
203
|
+
TQDM iterable object (`tqdm.tqdm`)
|
|
204
|
+
"""
|
|
205
|
+
...
|
|
206
|
+
```
|
|
207
|
+
*P.S.: DocString part and other arguments of the function are copied from `tqdm/std.py`*
|
|
208
|
+
|
|
209
|
+
## Build
|
|
210
|
+
### To build the package, run:
|
|
211
|
+
```bash
|
|
212
|
+
python -m pip install build
|
|
213
|
+
python -m build .
|
|
214
|
+
```
|
|
215
|
+
Don't forget to change the config in the `pyproject.toml` file before doing this.\
|
|
216
|
+
**All distributions are stored in the `dist` folder**
|
|
217
|
+
|
|
218
|
+
## Workflows
|
|
219
|
+
**This project contains one workflow that:**
|
|
220
|
+
+ collects the wheel library,
|
|
221
|
+
+ adds it to the release files,
|
|
222
|
+
+ and uploads the release to PyPi.
|
|
223
|
+
|
|
224
|
+
**Also, project contains pytest and pylint workflows**
|
|
225
|
+
|
|
226
|
+
## If you encounter any errors, please open [issue](https://github.com/IgorNk500/tqdm-styles/issues/new "New issue") on GitHub.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
dynamic = ["version"]
|
|
7
|
+
|
|
8
|
+
name = "tqdm-styles"
|
|
9
|
+
description = "Some progress bar presets (styles) for TQDM"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
keywords = ["tqdmstyles", "styles-tqdm", "stylestqdm"]
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
authors = [
|
|
15
|
+
{ name = "IgorNk500", email = "igornk500@outlook.com" },
|
|
16
|
+
]
|
|
17
|
+
requires-python = ">=3.10.0"
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Development Status :: 1 - Planning",
|
|
21
|
+
"Environment :: Console",
|
|
22
|
+
"Intended Audience :: Developers"
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
dependencies = [
|
|
26
|
+
"tqdm"
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/IgorNk500/tqdm-styles"
|
|
31
|
+
Documentation = "https://github.com/IgorNk500/tqdm-styles/wiki"
|
|
32
|
+
Repository = "https://github.com/IgorNk500/tqdm-styles"
|
|
33
|
+
Issues = "https://github.com/IgorNk500/tqdm-styles/issues"
|
|
34
|
+
Changelog = "https://github.com/IgorNk500/tqdm-styles/blob/main/CHANGELOG.md"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.dynamic]
|
|
38
|
+
version = {attr = "tqdm_styles.__version__"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""**Some progress bar presets (styles) for TQDM**
|
|
2
|
+
Read more in `__init__.pyi`"""
|
|
3
|
+
|
|
4
|
+
from .styles import tqdm_neon, tqdm_modern, tqdm_retro, tqdm_compact, tqdm_minimalistic
|
|
5
|
+
from .styles import STYLES
|
|
6
|
+
|
|
7
|
+
# Version definition
|
|
8
|
+
# Used as dynamic version in pyproject.toml (see pyproject.toml in repository)
|
|
9
|
+
__version__ = "1.0"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def tqdm(*args, style: str = "default", **kwargs):
|
|
13
|
+
"""See `__init__.pyi` for more info
|
|
14
|
+
:arg style: TQDM style (default, neon, modern, retro, compact, minimalistic).
|
|
15
|
+
Set `default` for use normal tqdm (`tqdm.tqdm`)
|
|
16
|
+
:returns TQDM iterable object"""
|
|
17
|
+
return STYLES[style](*args, **kwargs)
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"""Some progress bar presets (styles) for TQDM
|
|
2
|
+
|
|
3
|
+
Styles
|
|
4
|
+
----------
|
|
5
|
+
|
|
6
|
+
**Neon** - `neon` - Neon style\n
|
|
7
|
+
**Modern** - `modern` - Modern style\n
|
|
8
|
+
**Retro** - `retro` - Retro style\n
|
|
9
|
+
**Compact** - `compact` - Compact (without bar) style\n
|
|
10
|
+
**Minimalistic** - `minimalistic` - Minimalistic (dot) style\n
|
|
11
|
+
|
|
12
|
+
Links:
|
|
13
|
+
----------
|
|
14
|
+
|
|
15
|
+
+ **Homepage:** https://github.com/IgorNk500/tqdm-styles
|
|
16
|
+
+ **Documentation:** https://github.com/IgorNk500/tqdm-styles/wiki
|
|
17
|
+
+ **Repository:** https://github.com/IgorNk500/tqdm-styles
|
|
18
|
+
+ **Issues:** https://github.com/IgorNk500/tqdm-styles/issues
|
|
19
|
+
+ **Changelog:** https://github.com/IgorNk500/tqdm-styles/blob/main/CHANGELOG.md"""
|
|
20
|
+
from _typeshed import SupportsWrite
|
|
21
|
+
from typing import TypeVar, Iterable, Mapping
|
|
22
|
+
|
|
23
|
+
from importlib.metadata import version
|
|
24
|
+
|
|
25
|
+
from tqdm import tqdm as _tqdm
|
|
26
|
+
|
|
27
|
+
from .styles import tqdm_neon, tqdm_modern, tqdm_retro, tqdm_compact, tqdm_minimalistic
|
|
28
|
+
from .styles import STYLES
|
|
29
|
+
|
|
30
|
+
__author__ = "IgorNk500"
|
|
31
|
+
__version__ = version("tqdm-styles")
|
|
32
|
+
|
|
33
|
+
__all__ = ["STYLES",
|
|
34
|
+
"tqdm_neon",
|
|
35
|
+
"tqdm_modern",
|
|
36
|
+
"tqdm_retro",
|
|
37
|
+
"tqdm_compact",
|
|
38
|
+
"tqdm_minimalistic",
|
|
39
|
+
"tqdm"
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
_T = TypeVar("_T")
|
|
43
|
+
|
|
44
|
+
def tqdm(iterable: Iterable[_T],
|
|
45
|
+
desc: str | None = None,
|
|
46
|
+
total: float | None = None,
|
|
47
|
+
leave: bool | None = True,
|
|
48
|
+
file: SupportsWrite[str] | None = None,
|
|
49
|
+
ncols: int | None = None,
|
|
50
|
+
mininterval: float = 0.1,
|
|
51
|
+
maxinterval: float = 10.0,
|
|
52
|
+
miniters: float | None = None,
|
|
53
|
+
ascii: bool | str | None = None,
|
|
54
|
+
disable: bool | None = False,
|
|
55
|
+
unit: str = "it",
|
|
56
|
+
unit_scale: bool | float = False,
|
|
57
|
+
dynamic_ncols: bool = False,
|
|
58
|
+
smoothing: float = 0.3,
|
|
59
|
+
bar_format: str | None = None,
|
|
60
|
+
initial: float = 0,
|
|
61
|
+
position: int | None = None,
|
|
62
|
+
postfix: Mapping[str, object] | str | None = None,
|
|
63
|
+
unit_divisor: float = 1000,
|
|
64
|
+
write_bytes: bool = False,
|
|
65
|
+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = None,
|
|
66
|
+
nrows: int | None = None,
|
|
67
|
+
colour: str | None = None,
|
|
68
|
+
delay: float | None = 0,
|
|
69
|
+
gui: bool = False,
|
|
70
|
+
style: str = "default",
|
|
71
|
+
**kwargs) -> _tqdm:
|
|
72
|
+
"""TQDM bar stylization. It is a function and returns TQDM object.
|
|
73
|
+
|
|
74
|
+
Styles
|
|
75
|
+
----------
|
|
76
|
+
**Neon** - `neon` - Neon style\n
|
|
77
|
+
**Modern** - `modern` - Modern style\n
|
|
78
|
+
**Retro** - `retro` - Retro style\n
|
|
79
|
+
**Compact** - `compact` - Compact (without bar) style\n
|
|
80
|
+
**Minimalistic** - `minimalistic` - Minimalistic (dot) style\n
|
|
81
|
+
|
|
82
|
+
Parameters
|
|
83
|
+
----------
|
|
84
|
+
iterable : iterable, optional
|
|
85
|
+
Iterable to decorate with a progress bar.
|
|
86
|
+
Leave blank to manually manage the updates.
|
|
87
|
+
desc : str, optional
|
|
88
|
+
Prefix for the progress bar.
|
|
89
|
+
total : int or float, optional
|
|
90
|
+
The number of expected iterations. If unspecified,
|
|
91
|
+
len(iterable) is used if possible. If float("inf") or as a last
|
|
92
|
+
resort, only basic progress statistics are displayed
|
|
93
|
+
(no ETA, no progress bar).
|
|
94
|
+
If `gui` is True and this parameter needs subsequent updating,
|
|
95
|
+
specify an initial arbitrary large positive number,
|
|
96
|
+
e.g. 9e9.
|
|
97
|
+
leave : bool, optional
|
|
98
|
+
If [default: True], keeps all traces of the progress bar
|
|
99
|
+
upon termination of iteration.
|
|
100
|
+
If `None`, will leave only if `position` is `0`.
|
|
101
|
+
file : `io.TextIOWrapper` or `io.StringIO`, optional
|
|
102
|
+
Specifies where to output the progress messages
|
|
103
|
+
(default: sys.stderr). Uses `file.write(str)` and `file.flush()`
|
|
104
|
+
methods. For encoding, see `write_bytes`.
|
|
105
|
+
ncols : int, optional
|
|
106
|
+
The width of the entire output message. If specified,
|
|
107
|
+
dynamically resizes the progress bar to stay within this bound.
|
|
108
|
+
If unspecified, attempts to use environment width. The
|
|
109
|
+
fallback is a meter width of 10 and no limit for the counter and
|
|
110
|
+
statistics. If 0, will not print any meter (only stats).
|
|
111
|
+
mininterval : float, optional
|
|
112
|
+
Minimum progress display update interval [default: 0.1] seconds.
|
|
113
|
+
maxinterval : float, optional
|
|
114
|
+
Maximum progress display update interval [default: 10] seconds.
|
|
115
|
+
Automatically adjusts `miniters` to correspond to `mininterval`
|
|
116
|
+
after long display update lag. Only works if `dynamic_miniters`
|
|
117
|
+
or monitor thread is enabled.
|
|
118
|
+
miniters : int or float, optional
|
|
119
|
+
Minimum progress display update interval, in iterations.
|
|
120
|
+
If 0 and `dynamic_miniters`, will automatically adjust to equal
|
|
121
|
+
`mininterval` (more CPU efficient, good for tight loops).
|
|
122
|
+
If > 0, will skip display of specified number of iterations.
|
|
123
|
+
Tweak this and `mininterval` to get very efficient loops.
|
|
124
|
+
If your progress is erratic with both fast and slow iterations
|
|
125
|
+
(network, skipping items, etc) you should set miniters=1.
|
|
126
|
+
ascii : bool or str, optional
|
|
127
|
+
If unspecified or False, use unicode (smooth blocks) to fill
|
|
128
|
+
the meter. The fallback is to use ASCII characters " 123456789#".
|
|
129
|
+
disable : bool, optional
|
|
130
|
+
Whether to disable the entire progress bar wrapper
|
|
131
|
+
[default: False]. If set to None, disable on non-TTY.
|
|
132
|
+
unit : str, optional
|
|
133
|
+
String that will be used to define the unit of each iteration
|
|
134
|
+
[default: it].
|
|
135
|
+
unit_scale : bool or int or float, optional
|
|
136
|
+
If 1 or True, the number of iterations will be reduced/scaled
|
|
137
|
+
automatically and a metric prefix following the
|
|
138
|
+
International System of Units standard will be added
|
|
139
|
+
(kilo, mega, etc.) [default: False]. If any other non-zero
|
|
140
|
+
number, will scale `total` and `n`.
|
|
141
|
+
dynamic_ncols : bool, optional
|
|
142
|
+
If set, constantly alters `ncols` and `nrows` to the
|
|
143
|
+
environment (allowing for window resizes) [default: False].
|
|
144
|
+
smoothing : float, optional
|
|
145
|
+
Exponential moving average smoothing factor for speed estimates
|
|
146
|
+
(ignored in GUI mode). Ranges from 0 (average speed) to 1
|
|
147
|
+
(current/instantaneous speed) [default: 0.3].
|
|
148
|
+
bar_format : str, optional
|
|
149
|
+
Specify a custom bar string formatting. May impact performance.
|
|
150
|
+
[default: '{l_bar}{bar}{r_bar}'], where
|
|
151
|
+
l_bar='{desc}: {percentage:3.0f}%|' and
|
|
152
|
+
r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, '
|
|
153
|
+
'{rate_fmt}{postfix}]'
|
|
154
|
+
Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,
|
|
155
|
+
percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,
|
|
156
|
+
rate, rate_fmt, rate_noinv, rate_noinv_fmt,
|
|
157
|
+
rate_inv, rate_inv_fmt, postfix, unit_divisor,
|
|
158
|
+
remaining, remaining_s, eta.
|
|
159
|
+
Note that a trailing ": " is automatically removed after {desc}
|
|
160
|
+
if the latter is empty.
|
|
161
|
+
initial : int or float, optional
|
|
162
|
+
The initial counter value. Useful when restarting a progress
|
|
163
|
+
bar [default: 0]. If using float, consider specifying `{n:.3f}`
|
|
164
|
+
or similar in `bar_format`, or specifying `unit_scale`.
|
|
165
|
+
position : int, optional
|
|
166
|
+
Specify the line offset to print this bar (starting from 0)
|
|
167
|
+
Automatic if unspecified.
|
|
168
|
+
Useful to manage multiple bars at once (eg, from threads).
|
|
169
|
+
postfix : dict or *, optional
|
|
170
|
+
Specify additional stats to display at the end of the bar.
|
|
171
|
+
Calls `set_postfix(**postfix)` if possible (dict).
|
|
172
|
+
unit_divisor : float, optional
|
|
173
|
+
[default: 1000], ignored unless `unit_scale` is True.
|
|
174
|
+
write_bytes : bool, optional
|
|
175
|
+
Whether to write bytes. If (default: False) will write unicode.
|
|
176
|
+
lock_args : tuple, optional
|
|
177
|
+
Passed to `refresh` for intermediate output
|
|
178
|
+
(initialisation, iterating, and updating).
|
|
179
|
+
nrows : int, optional
|
|
180
|
+
The screen height. If specified, hides nested bars outside this
|
|
181
|
+
bound. If unspecified, attempts to use environment height.
|
|
182
|
+
The fallback is 20.
|
|
183
|
+
colour : str, optional
|
|
184
|
+
Bar colour (e.g. 'green', '#00ff00').
|
|
185
|
+
delay : float, optional
|
|
186
|
+
Don't display until [default: 0] seconds have elapsed.
|
|
187
|
+
gui : bool, optional
|
|
188
|
+
WARNING: internal parameter - do not use.
|
|
189
|
+
Use tqdm.gui.tqdm(...) instead. If set, will attempt to use
|
|
190
|
+
matplotlib animations for a graphical output [default: False].
|
|
191
|
+
style : str, optional
|
|
192
|
+
TQDM style (default, neon, modern, retro, compact, minimalistic). Set `default` for use normal tqdm (`tqdm.tqdm`)
|
|
193
|
+
|
|
194
|
+
Returns
|
|
195
|
+
-------
|
|
196
|
+
TQDM iterable object (`tqdm.tqdm`)
|
|
197
|
+
"""
|
|
198
|
+
...
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""TQDM Bar styles
|
|
2
|
+
Taken from TQDM community"""
|
|
3
|
+
from tqdm import tqdm
|
|
4
|
+
__all__ = ["STYLES", "tqdm_neon", "tqdm_modern", "tqdm_retro", "tqdm_compact", "tqdm_minimalistic"]
|
|
5
|
+
|
|
6
|
+
def tqdm_neon(iterable, desc: str ="Task", colour: str | None = None,
|
|
7
|
+
gui: bool = False, **kwargs):
|
|
8
|
+
"""Neon style"""
|
|
9
|
+
return tqdm(
|
|
10
|
+
iterable,
|
|
11
|
+
desc=desc,
|
|
12
|
+
bar_format="{desc}: "
|
|
13
|
+
"\033[1;36m{percentage:3.0f}%\033[0m |{bar}| {n_fmt}/{total_fmt} "
|
|
14
|
+
"[{elapsed}<{remaining}, {rate_fmt}]",
|
|
15
|
+
ascii=" \u2591\u2592\u2593\u2588",
|
|
16
|
+
colour="#00ffcc" if not colour else colour,
|
|
17
|
+
gui=gui,
|
|
18
|
+
**kwargs
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def tqdm_modern(iterable, desc: str ="Task", colour: str | None = None,
|
|
22
|
+
gui: bool = False, **kwargs):
|
|
23
|
+
"""Modern style"""
|
|
24
|
+
return tqdm(
|
|
25
|
+
iterable,
|
|
26
|
+
desc=desc,
|
|
27
|
+
bar_format="{desc}: "
|
|
28
|
+
"{percentage:3.0f}% |{bar}| [{elapsed}]",
|
|
29
|
+
ascii=" \u258f\u258e\u258d\u258c\u258b\u258a\u2589\u2588",
|
|
30
|
+
colour="magenta" if not colour else colour,
|
|
31
|
+
gui=gui,
|
|
32
|
+
**kwargs
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
def tqdm_retro(iterable, desc: str ="Task", colour: str | None = None,
|
|
36
|
+
gui: bool = False, **kwargs):
|
|
37
|
+
"""Retro style"""
|
|
38
|
+
return tqdm(
|
|
39
|
+
iterable,
|
|
40
|
+
desc=desc,
|
|
41
|
+
bar_format="{desc} [{bar}] ({percentage:3.0f}%)",
|
|
42
|
+
ascii=" =>",
|
|
43
|
+
ncols=80,
|
|
44
|
+
gui=gui,
|
|
45
|
+
colour=colour,
|
|
46
|
+
**kwargs
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def tqdm_compact(iterable, desc: str ="Task", colour: str | None = None,
|
|
50
|
+
gui: bool = False, **kwargs):
|
|
51
|
+
"""Compact (without bar) style"""
|
|
52
|
+
return tqdm(
|
|
53
|
+
iterable,
|
|
54
|
+
desc=desc,
|
|
55
|
+
bar_format="{desc}: "
|
|
56
|
+
"{n}/{total} | [{percentage:.1f}%] | Elapsed: {elapsed}",
|
|
57
|
+
gui=gui,
|
|
58
|
+
colour=colour,
|
|
59
|
+
**kwargs
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def tqdm_minimalistic(iterable, desc: str ="Task", colour: str | None = None,
|
|
63
|
+
gui: bool = False, **kwargs):
|
|
64
|
+
"""Minimalistic (dot) style"""
|
|
65
|
+
return tqdm(
|
|
66
|
+
iterable,
|
|
67
|
+
desc=desc,
|
|
68
|
+
bar_format="{desc} {percentage:3.0f}% |{bar}|",
|
|
69
|
+
ascii=" \u2219\u25cf",
|
|
70
|
+
colour="white" if not colour else colour,
|
|
71
|
+
gui=gui,
|
|
72
|
+
**kwargs
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# Styles dict
|
|
77
|
+
STYLES = {
|
|
78
|
+
"default" : tqdm,
|
|
79
|
+
"neon" : tqdm_neon,
|
|
80
|
+
"modern" : tqdm_modern,
|
|
81
|
+
"retro" : tqdm_retro,
|
|
82
|
+
"compact" : tqdm_compact,
|
|
83
|
+
"minimalistic" : tqdm_minimalistic
|
|
84
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tqdm-styles
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: Some progress bar presets (styles) for TQDM
|
|
5
|
+
Author-email: IgorNk500 <igornk500@outlook.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/IgorNk500/tqdm-styles
|
|
8
|
+
Project-URL: Documentation, https://github.com/IgorNk500/tqdm-styles/wiki
|
|
9
|
+
Project-URL: Repository, https://github.com/IgorNk500/tqdm-styles
|
|
10
|
+
Project-URL: Issues, https://github.com/IgorNk500/tqdm-styles/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/IgorNk500/tqdm-styles/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: tqdmstyles,styles-tqdm,stylestqdm
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Development Status :: 1 - Planning
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Requires-Python: >=3.10.0
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: tqdm
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
<div align="center">
|
|
24
|
+
<img src="https://raw.githubusercontent.com/tqdm/tqdm/refs/heads/master/images/logo.gif" alt="TQDM logo">
|
|
25
|
+
<br/>
|
|
26
|
+
<br/>
|
|
27
|
+
<a href="https://github.com/IgorNk500/tqdm-styles/actions/workflows/release_build.yml"><img src="https://github.com/IgorNk500/tqdm-styles/actions/workflows/release_build.yml/badge.svg" alt="Package build"></a>
|
|
28
|
+
<a href="https://github.com/IgorNk500/tqdm-styles/actions/workflows/pylint.yml"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/IgorNk500/8968adb8b6d3e6f1759c69835be871b5/raw/pylint.json" alt="PyLint lint"></a>
|
|
29
|
+
<br/>
|
|
30
|
+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/pypi/pyversions/tqdm-styles" alt="Supported python versions"></a>
|
|
31
|
+
<a href="https://github.com/IgorNk500/tqdm-styles"><img src="https://img.shields.io/badge/github-repo-blue?logo=github" alt="Github repository"></a>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
***
|
|
35
|
+
|
|
36
|
+
# TQDM Styles
|
|
37
|
+
### Some progress bar presets (styles) for [TQDM Python library](https://pypi.org/project/tqdm/)
|
|
38
|
+
###### *[(Go to changelog)](CHANGELOG.md)*
|
|
39
|
+
|
|
40
|
+
## Table of contents
|
|
41
|
+
1. [Installing](#installing)
|
|
42
|
+
2. [Styles](#styles)
|
|
43
|
+
3. [Usage](#usage)
|
|
44
|
+
4. [Build](#build)
|
|
45
|
+
5. [Workflows](#workflows)
|
|
46
|
+
|
|
47
|
+
## Installing
|
|
48
|
+
```bash
|
|
49
|
+
python -m pip install -U tqdm tqdm-styles
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Styles
|
|
53
|
+
| **Style name** | Style ID in [`style` param](#or-use-one-function-with-style-parameter) | Description |
|
|
54
|
+
|------------------|------------------------------------------------------------------------|-----------------------------|
|
|
55
|
+
| **Neon** | `neon` | Neon style |
|
|
56
|
+
| **Modern** | `modern` | Modern style |
|
|
57
|
+
| **Retro** | `retro` | Retro style |
|
|
58
|
+
| **Compact** | `compact` | Compact (without bar) style |
|
|
59
|
+
| **Minimalistic** | `minimalistic` | Minimalistic (dot) style |
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
### You can call styles separately...:
|
|
63
|
+
```python
|
|
64
|
+
from tqdm_styles import tqdm_neon
|
|
65
|
+
from tqdm_styles import tqdm_modern
|
|
66
|
+
from tqdm_styles import tqdm_retro
|
|
67
|
+
from tqdm_styles import tqdm_compact
|
|
68
|
+
from tqdm_styles import tqdm_minimalistic
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### ...Or use one function with `style` parameter:
|
|
72
|
+
```python
|
|
73
|
+
def tqdm(iterable: Iterable[_T],
|
|
74
|
+
desc: str | None = None,
|
|
75
|
+
total: float | None = None,
|
|
76
|
+
leave: bool | None = True,
|
|
77
|
+
file: SupportsWrite[str] | None = None,
|
|
78
|
+
ncols: int | None = None,
|
|
79
|
+
mininterval: float = 0.1,
|
|
80
|
+
maxinterval: float = 10.0,
|
|
81
|
+
miniters: float | None = None,
|
|
82
|
+
ascii: bool | str | None = None,
|
|
83
|
+
disable: bool | None = False,
|
|
84
|
+
unit: str = "it",
|
|
85
|
+
unit_scale: bool | float = False,
|
|
86
|
+
dynamic_ncols: bool = False,
|
|
87
|
+
smoothing: float = 0.3,
|
|
88
|
+
bar_format: str | None = None,
|
|
89
|
+
initial: float = 0,
|
|
90
|
+
position: int | None = None,
|
|
91
|
+
postfix: Mapping[str, object] | str | None = None,
|
|
92
|
+
unit_divisor: float = 1000,
|
|
93
|
+
write_bytes: bool = False,
|
|
94
|
+
lock_args: tuple[bool | None, float | None] | tuple[bool | None] | None = None,
|
|
95
|
+
nrows: int | None = None,
|
|
96
|
+
colour: str | None = None,
|
|
97
|
+
delay: float | None = 0,
|
|
98
|
+
gui: bool = False,
|
|
99
|
+
style: str = "default",
|
|
100
|
+
**kwargs) -> _tqdm:
|
|
101
|
+
"""TQDM bar stylization. It is a function and returns TQDM object.
|
|
102
|
+
|
|
103
|
+
Styles
|
|
104
|
+
----------
|
|
105
|
+
**Neon** - `neon` - Neon style\n
|
|
106
|
+
**Modern** - `modern` - Modern style\n
|
|
107
|
+
**Retro** - `retro` - Retro style\n
|
|
108
|
+
**Compact** - `compact` - Compact (without bar) style\n
|
|
109
|
+
**Minimalistic** - `minimalistic` - Minimalistic (dot) style\n
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
iterable : iterable, optional
|
|
114
|
+
Iterable to decorate with a progress bar.
|
|
115
|
+
Leave blank to manually manage the updates.
|
|
116
|
+
desc : str, optional
|
|
117
|
+
Prefix for the progress bar.
|
|
118
|
+
total : int or float, optional
|
|
119
|
+
The number of expected iterations. If unspecified,
|
|
120
|
+
len(iterable) is used if possible. If float("inf") or as a last
|
|
121
|
+
resort, only basic progress statistics are displayed
|
|
122
|
+
(no ETA, no progress bar).
|
|
123
|
+
If `gui` is True and this parameter needs subsequent updating,
|
|
124
|
+
specify an initial arbitrary large positive number,
|
|
125
|
+
e.g. 9e9.
|
|
126
|
+
leave : bool, optional
|
|
127
|
+
If [default: True], keeps all traces of the progress bar
|
|
128
|
+
upon termination of iteration.
|
|
129
|
+
If `None`, will leave only if `position` is `0`.
|
|
130
|
+
file : `io.TextIOWrapper` or `io.StringIO`, optional
|
|
131
|
+
Specifies where to output the progress messages
|
|
132
|
+
(default: sys.stderr). Uses `file.write(str)` and `file.flush()`
|
|
133
|
+
methods. For encoding, see `write_bytes`.
|
|
134
|
+
ncols : int, optional
|
|
135
|
+
The width of the entire output message. If specified,
|
|
136
|
+
dynamically resizes the progress bar to stay within this bound.
|
|
137
|
+
If unspecified, attempts to use environment width. The
|
|
138
|
+
fallback is a meter width of 10 and no limit for the counter and
|
|
139
|
+
statistics. If 0, will not print any meter (only stats).
|
|
140
|
+
mininterval : float, optional
|
|
141
|
+
Minimum progress display update interval [default: 0.1] seconds.
|
|
142
|
+
maxinterval : float, optional
|
|
143
|
+
Maximum progress display update interval [default: 10] seconds.
|
|
144
|
+
Automatically adjusts `miniters` to correspond to `mininterval`
|
|
145
|
+
after long display update lag. Only works if `dynamic_miniters`
|
|
146
|
+
or monitor thread is enabled.
|
|
147
|
+
miniters : int or float, optional
|
|
148
|
+
Minimum progress display update interval, in iterations.
|
|
149
|
+
If 0 and `dynamic_miniters`, will automatically adjust to equal
|
|
150
|
+
`mininterval` (more CPU efficient, good for tight loops).
|
|
151
|
+
If > 0, will skip display of specified number of iterations.
|
|
152
|
+
Tweak this and `mininterval` to get very efficient loops.
|
|
153
|
+
If your progress is erratic with both fast and slow iterations
|
|
154
|
+
(network, skipping items, etc) you should set miniters=1.
|
|
155
|
+
ascii : bool or str, optional
|
|
156
|
+
If unspecified or False, use unicode (smooth blocks) to fill
|
|
157
|
+
the meter. The fallback is to use ASCII characters " 123456789#".
|
|
158
|
+
disable : bool, optional
|
|
159
|
+
Whether to disable the entire progress bar wrapper
|
|
160
|
+
[default: False]. If set to None, disable on non-TTY.
|
|
161
|
+
unit : str, optional
|
|
162
|
+
String that will be used to define the unit of each iteration
|
|
163
|
+
[default: it].
|
|
164
|
+
unit_scale : bool or int or float, optional
|
|
165
|
+
If 1 or True, the number of iterations will be reduced/scaled
|
|
166
|
+
automatically and a metric prefix following the
|
|
167
|
+
International System of Units standard will be added
|
|
168
|
+
(kilo, mega, etc.) [default: False]. If any other non-zero
|
|
169
|
+
number, will scale `total` and `n`.
|
|
170
|
+
dynamic_ncols : bool, optional
|
|
171
|
+
If set, constantly alters `ncols` and `nrows` to the
|
|
172
|
+
environment (allowing for window resizes) [default: False].
|
|
173
|
+
smoothing : float, optional
|
|
174
|
+
Exponential moving average smoothing factor for speed estimates
|
|
175
|
+
(ignored in GUI mode). Ranges from 0 (average speed) to 1
|
|
176
|
+
(current/instantaneous speed) [default: 0.3].
|
|
177
|
+
bar_format : str, optional
|
|
178
|
+
Specify a custom bar string formatting. May impact performance.
|
|
179
|
+
[default: '{l_bar}{bar}{r_bar}'], where
|
|
180
|
+
l_bar='{desc}: {percentage:3.0f}%|' and
|
|
181
|
+
r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, '
|
|
182
|
+
'{rate_fmt}{postfix}]'
|
|
183
|
+
Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt,
|
|
184
|
+
percentage, elapsed, elapsed_s, ncols, nrows, desc, unit,
|
|
185
|
+
rate, rate_fmt, rate_noinv, rate_noinv_fmt,
|
|
186
|
+
rate_inv, rate_inv_fmt, postfix, unit_divisor,
|
|
187
|
+
remaining, remaining_s, eta.
|
|
188
|
+
Note that a trailing ": " is automatically removed after {desc}
|
|
189
|
+
if the latter is empty.
|
|
190
|
+
initial : int or float, optional
|
|
191
|
+
The initial counter value. Useful when restarting a progress
|
|
192
|
+
bar [default: 0]. If using float, consider specifying `{n:.3f}`
|
|
193
|
+
or similar in `bar_format`, or specifying `unit_scale`.
|
|
194
|
+
position : int, optional
|
|
195
|
+
Specify the line offset to print this bar (starting from 0)
|
|
196
|
+
Automatic if unspecified.
|
|
197
|
+
Useful to manage multiple bars at once (eg, from threads).
|
|
198
|
+
postfix : dict or *, optional
|
|
199
|
+
Specify additional stats to display at the end of the bar.
|
|
200
|
+
Calls `set_postfix(**postfix)` if possible (dict).
|
|
201
|
+
unit_divisor : float, optional
|
|
202
|
+
[default: 1000], ignored unless `unit_scale` is True.
|
|
203
|
+
write_bytes : bool, optional
|
|
204
|
+
Whether to write bytes. If (default: False) will write unicode.
|
|
205
|
+
lock_args : tuple, optional
|
|
206
|
+
Passed to `refresh` for intermediate output
|
|
207
|
+
(initialisation, iterating, and updating).
|
|
208
|
+
nrows : int, optional
|
|
209
|
+
The screen height. If specified, hides nested bars outside this
|
|
210
|
+
bound. If unspecified, attempts to use environment height.
|
|
211
|
+
The fallback is 20.
|
|
212
|
+
colour : str, optional
|
|
213
|
+
Bar colour (e.g. 'green', '#00ff00').
|
|
214
|
+
delay : float, optional
|
|
215
|
+
Don't display until [default: 0] seconds have elapsed.
|
|
216
|
+
gui : bool, optional
|
|
217
|
+
WARNING: internal parameter - do not use.
|
|
218
|
+
Use tqdm.gui.tqdm(...) instead. If set, will attempt to use
|
|
219
|
+
matplotlib animations for a graphical output [default: False].
|
|
220
|
+
style : str, optional
|
|
221
|
+
TQDM style (default, neon, modern, retro, compact, minimalistic). Set `default` for use normal tqdm (`tqdm.tqdm`)
|
|
222
|
+
|
|
223
|
+
Returns
|
|
224
|
+
-------
|
|
225
|
+
TQDM iterable object (`tqdm.tqdm`)
|
|
226
|
+
"""
|
|
227
|
+
...
|
|
228
|
+
```
|
|
229
|
+
*P.S.: DocString part and other arguments of the function are copied from `tqdm/std.py`*
|
|
230
|
+
|
|
231
|
+
## Build
|
|
232
|
+
### To build the package, run:
|
|
233
|
+
```bash
|
|
234
|
+
python -m pip install build
|
|
235
|
+
python -m build .
|
|
236
|
+
```
|
|
237
|
+
Don't forget to change the config in the `pyproject.toml` file before doing this.\
|
|
238
|
+
**All distributions are stored in the `dist` folder**
|
|
239
|
+
|
|
240
|
+
## Workflows
|
|
241
|
+
**This project contains one workflow that:**
|
|
242
|
+
+ collects the wheel library,
|
|
243
|
+
+ adds it to the release files,
|
|
244
|
+
+ and uploads the release to PyPi.
|
|
245
|
+
|
|
246
|
+
**Also, project contains pytest and pylint workflows**
|
|
247
|
+
|
|
248
|
+
## If you encounter any errors, please open [issue](https://github.com/IgorNk500/tqdm-styles/issues/new "New issue") on GitHub.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
tqdm_styles/__init__.py
|
|
5
|
+
tqdm_styles/__init__.pyi
|
|
6
|
+
tqdm_styles/styles.py
|
|
7
|
+
tqdm_styles.egg-info/PKG-INFO
|
|
8
|
+
tqdm_styles.egg-info/SOURCES.txt
|
|
9
|
+
tqdm_styles.egg-info/dependency_links.txt
|
|
10
|
+
tqdm_styles.egg-info/requires.txt
|
|
11
|
+
tqdm_styles.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tqdm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tqdm_styles
|