1Metadata-Version: 2.1 2Name: progressbar2 3Version: 3.55.0 4Summary: A Python Progressbar library to provide visual (yet text based) progress to long running operations. 5Home-page: https://github.com/WoLpH/python-progressbar 6Author: Rick van Hattem (Wolph) 7Author-email: wolph@wol.ph 8License: BSD 9Description: ############################################################################## 10 Text progress bar library for Python. 11 ############################################################################## 12 13 Build status: 14 15 .. image:: https://github.com/WoLpH/python-progressbar/actions/workflows/main.yml/badge.svg 16 :alt: python-progressbar test status 17 :target: https://github.com/WoLpH/python-progressbar/actions 18 19 Coverage: 20 21 .. image:: https://coveralls.io/repos/WoLpH/python-progressbar/badge.svg?branch=master 22 :target: https://coveralls.io/r/WoLpH/python-progressbar?branch=master 23 24 ****************************************************************************** 25 Install 26 ****************************************************************************** 27 28 The package can be installed through `pip` (this is the recommended method): 29 30 pip install progressbar2 31 32 Or if `pip` is not available, `easy_install` should work as well: 33 34 easy_install progressbar2 35 36 Or download the latest release from Pypi (https://pypi.python.org/pypi/progressbar2) or Github. 37 38 Note that the releases on Pypi are signed with my GPG key (https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE81444E9CE1F695D) and can be checked using GPG: 39 40 gpg --verify progressbar2-<version>.tar.gz.asc progressbar2-<version>.tar.gz 41 42 ****************************************************************************** 43 Introduction 44 ****************************************************************************** 45 46 A text progress bar is typically used to display the progress of a long 47 running operation, providing a visual cue that processing is underway. 48 49 The progressbar is based on the old Python progressbar package that was published on the now defunct Google Code. Since that project was completely abandoned by its developer and the developer did not respond to email, I decided to fork the package. This package is still backwards compatible with the original progressbar package so you can safely use it as a drop-in replacement for existing project. 50 51 The ProgressBar class manages the current progress, and the format of the line 52 is given by a number of widgets. A widget is an object that may display 53 differently depending on the state of the progress bar. There are many types 54 of widgets: 55 56 - `AbsoluteETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AbsoluteETA>`_ 57 - `AdaptiveETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AdaptiveETA>`_ 58 - `AdaptiveTransferSpeed <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AdaptiveTransferSpeed>`_ 59 - `AnimatedMarker <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AnimatedMarker>`_ 60 - `Bar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Bar>`_ 61 - `BouncingBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#BouncingBar>`_ 62 - `Counter <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Counter>`_ 63 - `CurrentTime <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#CurrentTime>`_ 64 - `DataSize <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#DataSize>`_ 65 - `DynamicMessage <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#DynamicMessage>`_ 66 - `ETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#ETA>`_ 67 - `FileTransferSpeed <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FileTransferSpeed>`_ 68 - `FormatCustomText <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FormatCustomText>`_ 69 - `FormatLabel <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FormatLabel>`_ 70 - `FormatLabelBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FormatLabel>`_ 71 - `GranularBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#GranularBar>`_ 72 - `Percentage <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Percentage>`_ 73 - `PercentageLabelBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#PercentageLabelBar>`_ 74 - `ReverseBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#ReverseBar>`_ 75 - `RotatingMarker <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#RotatingMarker>`_ 76 - `SimpleProgress <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#SimpleProgress>`_ 77 - `Timer <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Timer>`_ 78 79 The progressbar module is very easy to use, yet very powerful. It will also 80 automatically enable features like auto-resizing when the system supports it. 81 82 ****************************************************************************** 83 Known issues 84 ****************************************************************************** 85 86 Due to limitations in both the IDLE shell and the Jetbrains (Pycharm) shells this progressbar cannot function properly within those. 87 88 - The IDLE editor doesn't support these types of progress bars at all: https://bugs.python.org/issue23220 89 - The Jetbrains (Pycharm) editors partially work but break with fast output. As a workaround make sure you only write to either `sys.stdout` (regular print) or `sys.stderr` at the same time. If you do plan to use both, make sure you wait about ~200 milliseconds for the next output or it will break regularly. Linked issue: https://github.com/WoLpH/python-progressbar/issues/115 90 - Jupyter notebooks buffer `sys.stdout` which can cause mixed output. This issue can be resolved easily using: `import sys; sys.stdout.flush()`. Linked issue: https://github.com/WoLpH/python-progressbar/issues/173 91 92 ****************************************************************************** 93 Links 94 ****************************************************************************** 95 96 * Documentation 97 - https://progressbar-2.readthedocs.org/en/latest/ 98 * Source 99 - https://github.com/WoLpH/python-progressbar 100 * Bug reports 101 - https://github.com/WoLpH/python-progressbar/issues 102 * Package homepage 103 - https://pypi.python.org/pypi/progressbar2 104 * My blog 105 - https://w.wol.ph/ 106 107 ****************************************************************************** 108 Usage 109 ****************************************************************************** 110 111 There are many ways to use Python Progressbar, you can see a few basic examples 112 here but there are many more in the examples file. 113 114 Wrapping an iterable 115 ============================================================================== 116 .. code:: python 117 118 import time 119 import progressbar 120 121 for i in progressbar.progressbar(range(100)): 122 time.sleep(0.02) 123 124 Progressbars with logging 125 ============================================================================== 126 127 Progressbars with logging require `stderr` redirection _before_ the 128 `StreamHandler` is initialized. To make sure the `stderr` stream has been 129 redirected on time make sure to call `progressbar.streams.wrap_stderr()` before 130 you initialize the `logger`. 131 132 One option to force early initialization is by using the `WRAP_STDERR` 133 environment variable, on Linux/Unix systems this can be done through: 134 135 .. code:: sh 136 137 # WRAP_STDERR=true python your_script.py 138 139 If you need to flush manually while wrapping, you can do so using: 140 141 .. code:: python 142 143 import progressbar 144 145 progressbar.streams.flush() 146 147 In most cases the following will work as well, as long as you initialize the 148 `StreamHandler` after the wrapping has taken place. 149 150 .. code:: python 151 152 import time 153 import logging 154 import progressbar 155 156 progressbar.streams.wrap_stderr() 157 logging.basicConfig() 158 159 for i in progressbar.progressbar(range(10)): 160 logging.error('Got %d', i) 161 time.sleep(0.2) 162 163 Context wrapper 164 ============================================================================== 165 .. code:: python 166 167 import time 168 import progressbar 169 170 with progressbar.ProgressBar(max_value=10) as bar: 171 for i in range(10): 172 time.sleep(0.1) 173 bar.update(i) 174 175 Combining progressbars with print output 176 ============================================================================== 177 .. code:: python 178 179 import time 180 import progressbar 181 182 for i in progressbar.progressbar(range(100), redirect_stdout=True): 183 print('Some text', i) 184 time.sleep(0.1) 185 186 Progressbar with unknown length 187 ============================================================================== 188 .. code:: python 189 190 import time 191 import progressbar 192 193 bar = progressbar.ProgressBar(max_value=progressbar.UnknownLength) 194 for i in range(20): 195 time.sleep(0.1) 196 bar.update(i) 197 198 Bar with custom widgets 199 ============================================================================== 200 .. code:: python 201 202 import time 203 import progressbar 204 205 widgets=[ 206 ' [', progressbar.Timer(), '] ', 207 progressbar.Bar(), 208 ' (', progressbar.ETA(), ') ', 209 ] 210 for i in progressbar.progressbar(range(20), widgets=widgets): 211 time.sleep(0.1) 212 213 Bar with wide Chinese (or other multibyte) characters 214 ============================================================================== 215 216 .. code:: python 217 218 # vim: fileencoding=utf-8 219 import time 220 import progressbar 221 222 223 def custom_len(value): 224 # These characters take up more space 225 characters = { 226 '进': 2, 227 '度': 2, 228 } 229 230 total = 0 231 for c in value: 232 total += characters.get(c, 1) 233 234 return total 235 236 237 bar = progressbar.ProgressBar( 238 widgets=[ 239 '进度: ', 240 progressbar.Bar(), 241 ' ', 242 progressbar.Counter(format='%(value)02d/%(max_value)d'), 243 ], 244 len_func=custom_len, 245 ) 246 for i in bar(range(10)): 247 time.sleep(0.1) 248 249Keywords: Python Progressbar 250Platform: UNKNOWN 251Classifier: Development Status :: 6 - Mature 252Classifier: Intended Audience :: Developers 253Classifier: License :: OSI Approved :: BSD License 254Classifier: Natural Language :: English 255Classifier: Programming Language :: Python :: 2 256Classifier: Programming Language :: Python :: 2.7 257Classifier: Programming Language :: Python :: 3 258Classifier: Programming Language :: Python :: 3.4 259Classifier: Programming Language :: Python :: 3.5 260Classifier: Programming Language :: Python :: 3.6 261Classifier: Programming Language :: Python :: 3.7 262Classifier: Programming Language :: Python :: 3.8 263Classifier: Programming Language :: Python :: Implementation :: PyPy 264Provides-Extra: docs 265Provides-Extra: tests 266