33tqdm
44====
55
6- |PyPi-Status | |PyPi-Downloads | | PyPi- Versions |
6+ |PyPi-Status | |PyPi-Versions |
77
88|Build-Status | |Coverage-Status | |Branch-Coverage-Status |
99
@@ -69,7 +69,7 @@ Installation
6969Latest pypi stable release
7070~~~~~~~~~~~~~~~~~~~~~~~~~~
7171
72- |PyPi-Status | | PyPi-Downloads |
72+ |PyPi-Status |
7373
7474.. code :: sh
7575
@@ -127,7 +127,6 @@ Instantiation outside of the loop allows for manual control over ``tqdm()``:
127127 for char in pbar:
128128 pbar.set_description(" Processing %s " % char)
129129
130-
131130 Manual
132131~~~~~~
133132
@@ -152,7 +151,6 @@ but in this case don't forget to ``del`` or ``close()`` at the end:
152151 pbar.update(10 )
153152 pbar.close()
154153
155-
156154 Module
157155~~~~~~
158156
@@ -200,7 +198,7 @@ Backing up a large directory?
200198 Documentation
201199-------------
202200
203- |PyPi-Versions |
201+ |PyPi-Versions | | Readme-Hits | (Since 19 May 2016)
204202
205203.. code :: python
206204
@@ -298,7 +296,6 @@ Extra CLI Options
298296 String buffer size in bytes [default: 256]
299297 used when `delim ` is specified.
300298
301-
302299Returns
303300~~~~~~~
304301
@@ -380,6 +377,28 @@ Examples and Advanced Usage
380377See the `examples <https://github.com/tqdm/tqdm/tree/master/examples >`__
381378folder or import the module and run ``help() ``.
382379
380+ Nested progress bars
381+ ~~~~~~~~~~~~~~~~~~~~
382+
383+ ``tqdm `` supports nested progress bars. Here's an example:
384+
385+ .. code :: python
386+
387+ from tqdm import trange
388+ from time import sleep
389+
390+ for i in trange(10 , desc = ' 1st loop' ):
391+ for j in trange(5 , desc = ' 2nd loop' , leave = False ):
392+ for k in trange(100 , desc = ' 3nd loop' ):
393+ sleep(0.01 )
394+
395+ On Windows `colorama <https://github.com/tartley/colorama >`__ will be used if
396+ available to produce a beautiful nested display.
397+
398+ For manual control over positioning (e.g. for multi-threaded use),
399+ you may specify `position=n ` where `n=0 ` for the outermost bar,
400+ `n=1 ` for the next, and so on.
401+
383402Hooks and callbacks
384403~~~~~~~~~~~~~~~~~~~
385404
@@ -473,28 +492,6 @@ own callbacks), see the
473492`examples <https://github.com/tqdm/tqdm/tree/master/examples >`__
474493folder or import the module and run ``help() ``.
475494
476- Nested progress bars
477- ~~~~~~~~~~~~~~~~~~~~
478-
479- ``tqdm `` supports nested progress bars. Here's an example:
480-
481- .. code :: python
482-
483- from tqdm import trange
484- from time import sleep
485-
486- for i in trange(10 , desc = ' 1st loop' ):
487- for j in trange(5 , desc = ' 2nd loop' , leave = False ):
488- for k in trange(100 , desc = ' 3nd loop' ):
489- sleep(0.01 )
490-
491- On Windows `colorama <https://github.com/tartley/colorama >`__ will be used if
492- available to produce a beautiful nested display.
493-
494- For manual control over positioning (e.g. for multi-threaded use),
495- you may specify `position=n ` where `n=0 ` for the outermost bar,
496- `n=1 ` for the next, and so on.
497-
498495IPython/Jupyter Integration
499496~~~~~~~~~~~~~~~~~~~~~~~~~~~~
500497
@@ -519,7 +516,8 @@ light blue: no ETA); as demonstrated below.
519516|Screenshot-Jupyter3 |
520517
521518Writing messages
522- ~~~~~~~~~~~~~~~~~~~~
519+ ~~~~~~~~~~~~~~~~
520+
523521Since ``tqdm `` uses a simple printing mechanism to display progress bars,
524522you should not write any message in the terminal using ``print() ``.
525523
@@ -543,19 +541,18 @@ By default, this will print to standard output ``sys.stdout``. but you can
543541specify any file-like object using the ``file `` argument. For example, this
544542can be used to redirect the messages writing to a log file or class.
545543
546- Redirecting all printing to tqdm.write()
547- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
544+ Redirecting writing
545+ ~~~~~~~~~~~~~~~~~~~
548546
549- If your application is using a library that can print messages to the console,
550- you may not be willing to edit the library to replace ``print() `` by
551- ``tqdm.write() ``. In that case, you may want to redirect ``sys.stdout `` to
552- ``tqdm.write() ``.
547+ If using a library that can print messages to the console, editing the library
548+ by replacing ``print() `` with ``tqdm.write() `` may not be desirable.
549+ In that case, redirecting ``sys.stdout `` to ``tqdm.write() `` is an option.
553550
554- To redirect ``sys.stdout ``, you need to create a file-like class that will write
555- any input string to ``tqdm.write() ``, and you need to supply the arguments
556- ``file=sys.stdout, dynamic_ncols=True ``, else you will get funky issues .
551+ To redirect ``sys.stdout ``, create a file-like class that will write
552+ any input string to ``tqdm.write() ``, and supply the arguments
553+ ``file=sys.stdout, dynamic_ncols=True ``.
557554
558- Here is a canonical example that you can reuse :
555+ A reusable canonical example is given below :
559556
560557.. code :: python
561558
@@ -595,11 +592,11 @@ Here is a canonical example that you can reuse:
595592
596593 # Redirect stdout to tqdm.write() (don't forget the `as save_stdout`)
597594 with stdout_redirect_to_tqdm() as save_stdout:
598- # tqdm call need to specify sys.stdout, not sys.stderr (default)
599- # and dynamic_ncols=True to autodetect console width
600- for _ in tqdm(range (3 ), file = save_stdout, dynamic_ncols = True ):
601- blabla()
602- sleep(.5 )
595+ # tqdm call need to specify sys.stdout, not sys.stderr (default)
596+ # and dynamic_ncols=True to autodetect console width
597+ for _ in tqdm(range (3 ), file = save_stdout, dynamic_ncols = True ):
598+ blabla()
599+ sleep(.5 )
603600
604601 # After the `with`, printing is restored
605602 print (' Done!' )
@@ -768,6 +765,7 @@ Open Source (OSI approved): |Licence|
768765
769766Citation information: |DOI-URI |
770767
768+
771769Authors
772770-------
773771
0 commit comments