[Python-modules-commits] [tqdm] 01/04: Import tqdm_4.8.4.orig.tar.gz
Sandro Tosi
morph at moszumanska.debian.org
Sun Oct 2 20:26:37 UTC 2016
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository tqdm.
commit de21fd128559b6778cb21d8d8b76c0ea29683098
Author: Sandro Tosi <morph at debian.org>
Date: Sun Oct 2 16:21:06 2016 -0400
Import tqdm_4.8.4.orig.tar.gz
---
.coveragerc | 1 +
PKG-INFO | 232 +++++++++-----------------------------
README.rst | 230 +++++++++----------------------------
examples/pandas_progress_apply.py | 9 +-
examples/simple_examples.py | 52 ++++++---
setup.py | 17 ++-
tqdm.egg-info/PKG-INFO | 232 +++++++++-----------------------------
tqdm.egg-info/SOURCES.txt | 1 +
tqdm/__init__.py | 6 +-
tqdm/_main.py | 34 +++---
tqdm/_tqdm.py | 210 ++++++++++++++++++++++++++--------
tqdm/_tqdm_gui.py | 7 +-
tqdm/_tqdm_notebook.py | 108 +++++++++---------
tqdm/_tqdm_pandas.py | 60 ++++------
tqdm/_utils.py | 70 +++++-------
tqdm/_version.py | 4 +-
tqdm/tests/tests_main.py | 2 +-
tqdm/tests/tests_pandas.py | 79 ++++++++++---
tqdm/tests/tests_tqdm.py | 53 ++++++---
19 files changed, 595 insertions(+), 812 deletions(-)
diff --git a/.coveragerc b/.coveragerc
index bc69d52..ed240c1 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -3,3 +3,4 @@ branch = True
omit =
tqdm/tests/*
tqdm/_tqdm_gui.py
+ tqdm/_tqdm_notebook.py
diff --git a/PKG-INFO b/PKG-INFO
index 12f39a5..95caff0 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: tqdm
-Version: 4.7.4
+Version: 4.8.4
Summary: A Fast, Extensible Progress Meter
Home-page: https://github.com/tqdm/tqdm
Author: tqdm developers
@@ -11,17 +11,17 @@ Description: |Logo|
tqdm
====
- |PyPi-Status| |PyPi-Versions|
+ |PyPI-Status| |PyPI-Versions|
|Build-Status| |Coverage-Status| |Branch-Coverage-Status|
- |DOI-URI| |Licence|
+ |DOI-URI| |LICENCE|
``tqdm`` (read taqadum, تقدّم) means "progress" in arabic.
Instantly make your loops show a smart progress meter - just wrap any
- iterable with "tqdm(iterable)", and you're done!
+ iterable with ``tqdm(iterable)``, and you're done!
.. code:: python
@@ -31,13 +31,13 @@ Description: |Logo|
Here's what the output looks like:
- 76%\|████████████████████\ \| 7641/10000 [00:34<00:10,
- 222.22 it/s]
+ ``76%|████████████████████████████ | 7568/10000 [00:33<00:10, 229.00it/s]``
``trange(N)`` can be also used as a convenient shortcut for
``tqdm(xrange(N))``.
|Screenshot|
+ Screenshot using `bpython <http://www.bpython-interpreter.org/>`__
It can also be executed as a module with pipes:
@@ -74,10 +74,10 @@ Description: |Logo|
Installation
------------
- Latest pypi stable release
+ Latest PyPI stable release
~~~~~~~~~~~~~~~~~~~~~~~~~~
- |PyPi-Status|
+ |PyPI-Status|
.. code:: sh
@@ -86,7 +86,7 @@ Description: |Logo|
Latest development release on github
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- |Github-Status| |Github-Stars| |Github-Forks|
+ |GitHub-Status| |GitHub-Stars| |GitHub-Forks|
Pull and install in the current directory:
@@ -98,8 +98,8 @@ Description: |Logo|
Changelog
---------
- The list of all changes is available either on Github's Releases:
- |Github-Status| or on crawlers such as
+ The list of all changes is available either on GitHub's Releases:
+ |GitHub-Status| or on crawlers such as
`allmychanges.com <https://allmychanges.com/p/python/tqdm/>`_.
@@ -203,10 +203,29 @@ Description: |Logo|
100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
+ Help!
+ -----
+
+ The most common issues relate to excessive output on multiple lines, instead
+ of a neat one-line progress bar.
+
+ - Consoles in general: require support for carriage return (``CR``, ``\r``).
+ - Nested progress bars:
+ * Consoles in general: require support for moving cursors up to the
+ previous line. For example, `IDLE won't work <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__.
+ * Windows: additionally may require the python module ``colorama``.
+ - Wrapping enumerated iterables: use ``enumerate(tqdm(...))`` instead of
+ ``tqdm(enumerate(...))``. The same applies to ``numpy.ndenumerate``.
+ This is because enumerate functions tend to hide the length of iterables.
+ ``tqdm`` does not.
+
+ If you come across any other difficulties, browse/open issues
+ `here <https://github.com/tqdm/tqdm/issues?q=is%3Aissue>`__.
+
Documentation
-------------
- |PyPi-Versions| |Readme-Hits| (Since 19 May 2016)
+ |PyPI-Versions| |README-Hits| (Since 19 May 2016)
.. code:: python
@@ -382,8 +401,11 @@ Description: |Logo|
Examples and Advanced Usage
---------------------------
- See the `examples <https://github.com/tqdm/tqdm/tree/master/examples>`__
- folder or import the module and run ``help()``.
+ - See the `examples <https://github.com/tqdm/tqdm/tree/master/examples>`__
+ folder;
+ - import the module and run ``help()``, or
+ - consult the `wiki <https://github.com/tqdm/tqdm/wiki>`__.
+ - this has an `excellent article <https://github.com/tqdm/tqdm/wiki/How-to-Make-a-Great-Progressbar>`__ on how to make a **great** progressbar.
Nested progress bars
~~~~~~~~~~~~~~~~~~~~
@@ -480,17 +502,16 @@ Description: |Logo|
import pandas as pd
import numpy as np
- from tqdm import tqdm, tqdm_pandas
-
- ...
+ from tqdm import tqdm
df = pd.DataFrame(np.random.randint(0, 100, (100000, 6)))
- # Create and register a new `tqdm` instance with `pandas`
- # (can use tqdm_gui, optional kwargs, etc.)
- tqdm_pandas(tqdm())
+ # Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm`
+ # (can use `tqdm_gui`, `tqdm_notebook`, optional kwargs, etc.)
+ tqdm.pandas(desc="my bar!")
# Now you can use `progress_apply` instead of `apply`
+ # and `progress_map` instead of `map`
df.progress_apply(lambda x: x**2)
# can also groupby:
# df.groupby(0).progress_apply(lambda x: x**2)
@@ -609,167 +630,22 @@ Description: |Logo|
# After the `with`, printing is restored
print('Done!')
- How to make a good progress bar
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- A good progress bar is a useful progress bar. To be useful, ``tqdm`` displays
- statistics and uses smart algorithms to predict and automagically adapt to
- a variety of use cases with no or minimal configuration.
-
- However, there is one thing that ``tqdm`` cannot do: choose a pertinent
- progress indicator. To display a useful progress bar, it is very important that
- ``tqdm`` is supplied with the most pertinent progress indicator.
- This will reflect most accurately the current state of your program.
- Usually, a good way is to preprocess quickly to first evaluate the total amount
- of work to do before beginning the real processing.
-
- To illustrate the importance of a good progress indicator, take the
- following example: you want to walk through all files of a directory and
- process their contents with some external function:
-
- .. code:: python
-
- import os
- from tqdm import tqdm, trange
- from time import sleep
-
- def dosomething(buf):
- """Do something with the content of a file"""
- sleep(0.01)
- pass
-
- def walkdir(folder):
- """Walk through each files in a directory"""
- for dirpath, dirs, files in os.walk(folder):
- for filename in files:
- yield os.path.abspath(os.path.join(dirpath, filename))
-
- def process_content_no_progress(inputpath, blocksize=1024):
- for filepath in walkdir(inputpath):
- with open(filepath, 'rb') as fh:
- buf = 1
- while (buf):
- buf = fh.read(blocksize)
- dosomething(buf)
-
- ``process_content_no_progress()`` does the job, but does not show
- any information about the current progress, nor how long it will take.
-
- To quickly fix that using ``tqdm``, we can use this naive approach:
-
- .. code:: python
-
- def process_content_with_progress1(inputpath, blocksize=1024):
- for filepath in tqdm(walkdir(inputpath)):
- with open(filepath, 'rb') as fh:
- buf = 1
- while (buf):
- buf = fh.read(blocksize)
- dosomething(buf)
-
- ``process_content_with_progress1()`` will load ``tqdm()``, but since the
- iterator does not provide any length (``os.walkdir()`` does not have a
- ``__len__()`` method for the total files count), there is only an indication
- of the current and past program state, no prediction:
-
- ``4it [00:03, 2.79it/s]``
-
- The way to get predictive information is to know the total amount of work to be
- done. Since ``os.walkdir()`` cannot give us this information, we need to
- precompute this by ourselves:
-
- .. code:: python
-
- def process_content_with_progress2(inputpath, blocksize=1024):
- # Preprocess the total files count
- filecounter = 0
- for dirpath, dirs, files in tqdm(os.walk(inputpath)):
- for filename in files:
- filecounter += 1
-
- for filepath in tqdm(walkdir(inputpath), total=filecounter):
- with open(filepath, 'rb') as fh:
- buf = 1
- while (buf):
- buf = fh.read(blocksize)
- dosomething(buf)
-
- ``process_content_with_progress2()`` is better than the naive approach because
- now we have predictive information:
-
- 50%|████████████\ \| 2/4 [00:00<00:00, 4.06it/s]
-
- However, the progress is not smooth: it increments in steps, 1 step being
- 1 file processed. The problem is that we do not just walk through files tree,
- but we process the files contents. Thus, if we stumble on one very large file
- which takes a great deal more time to process than other smaller files,
- the progress bar
- will still considers that file is of equal processing weight.
-
- To fix this, we should use another indicator than the files count: the total
- sum of all files sizes. This would be more pertinent since the data we
- process is the files' content, so there is a direct relation between size and
- content.
-
- Below we implement this approach using a manually updated ``tqdm`` bar, where
- ``tqdm`` will work on size, while the ``for`` loop works on files paths:
-
- .. code:: python
-
- def process_content_with_progress3(inputpath, blocksize=1024):
- # Preprocess the total files sizes
- sizecounter = 0
- for dirpath, dirs, files in tqdm(os.walk(inputpath)):
- for filename in files:
- fullpath = os.path.abspath(os.path.join(dirpath, filename))
- sizecounter += os.stat(fullpath).st_size
-
- # Load tqdm with size counter instead of files counter
- with tqdm(total=sizecounter, unit='B', unit_scale=True) as pbar:
- for dirpath, dirs, files in os.walk(inputpath):
- for filename in files:
- fullpath = os.path.abspath(os.path.join(dirpath, filename))
- with open(fullpath, 'rb') as fh:
- buf = 1
- while (buf):
- buf = fh.read(blocksize)
- dosomething(buf)
- if buf: pbar.update(len(buf))
-
- And here is the result: a much smoother progress bar with meaningful
- predicted time and statistics:
-
- 47%|████████████\ \| 152K/321K [00:03<00:03, 46.2KB/s]
-
Contributions
-------------
- To run the testing suite please make sure tox (https://testrun.org/tox/latest/)
- is installed, then type ``tox`` from the command line.
-
- Where ``tox`` is unavailable, a Makefile-like setup is
- provided with the following command:
-
- .. code:: sh
-
- $ python setup.py make alltests
-
- To see all options, run:
-
- .. code:: sh
-
- $ python setup.py make
+ All source code is hosted on `GitHub <https://github.com/tqdm/tqdm>`__.
+ Contributions are welcome.
See the
`CONTRIBUTE <https://raw.githubusercontent.com/tqdm/tqdm/master/CONTRIBUTE>`__
file for more information.
- Licence
+ LICENCE
-------
- Open Source (OSI approved): |Licence|
+ Open Source (OSI approved): |LICENCE|
Citation information: |DOI-URI|
@@ -788,7 +664,7 @@ Description: |Logo|
`*` Original author
- |Readme-Hits| (Since 19 May 2016)
+ |README-Hits| (Since 19 May 2016)
.. |Logo| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/logo.png
.. |Screenshot| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm.gif
@@ -798,26 +674,26 @@ Description: |Logo|
:target: https://coveralls.io/r/tqdm/tqdm
.. |Branch-Coverage-Status| image:: https://codecov.io/github/tqdm/tqdm/coverage.svg?branch=master
:target: https://codecov.io/github/tqdm/tqdm?branch=master
- .. |Github-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=2592000
+ .. |GitHub-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=2592000
:target: https://github.com/tqdm/tqdm/releases
- .. |Github-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg
+ .. |GitHub-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg
:target: https://github.com/tqdm/tqdm/network
- .. |Github-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg
+ .. |GitHub-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg
:target: https://github.com/tqdm/tqdm/stargazers
- .. |PyPi-Status| image:: https://img.shields.io/pypi/v/tqdm.svg
+ .. |PyPI-Status| image:: https://img.shields.io/pypi/v/tqdm.svg
:target: https://pypi.python.org/pypi/tqdm
- .. |PyPi-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg
+ .. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg
:target: https://pypi.python.org/pypi/tqdm
- .. |PyPi-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg
+ .. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg
:target: https://pypi.python.org/pypi/tqdm
- .. |Licence| image:: https://img.shields.io/pypi/l/tqdm.svg
+ .. |LICENCE| image:: https://img.shields.io/pypi/l/tqdm.svg
:target: https://raw.githubusercontent.com/tqdm/tqdm/master/LICENCE
.. |DOI-URI| image:: https://zenodo.org/badge/21637/tqdm/tqdm.svg
:target: https://zenodo.org/badge/latestdoi/21637/tqdm/tqdm
.. |Screenshot-Jupyter1| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-1.gif
.. |Screenshot-Jupyter2| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-2.gif
.. |Screenshot-Jupyter3| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-3.gif
- .. |Readme-Hits| image:: http://hitt.herokuapp.com/tqdm/tqdm.svg
+ .. |README-Hits| image:: http://hitt.herokuapp.com/tqdm/tqdm.svg
Keywords: progressbar progressmeter progress bar meter rate eta console terminal time
Platform: any
diff --git a/README.rst b/README.rst
index cdfb6b7..958474b 100644
--- a/README.rst
+++ b/README.rst
@@ -3,17 +3,17 @@
tqdm
====
-|PyPi-Status| |PyPi-Versions|
+|PyPI-Status| |PyPI-Versions|
|Build-Status| |Coverage-Status| |Branch-Coverage-Status|
-|DOI-URI| |Licence|
+|DOI-URI| |LICENCE|
``tqdm`` (read taqadum, تقدّم) means "progress" in arabic.
Instantly make your loops show a smart progress meter - just wrap any
-iterable with "tqdm(iterable)", and you're done!
+iterable with ``tqdm(iterable)``, and you're done!
.. code:: python
@@ -23,13 +23,13 @@ iterable with "tqdm(iterable)", and you're done!
Here's what the output looks like:
-76%\|████████████████████\ \| 7641/10000 [00:34<00:10,
-222.22 it/s]
+``76%|████████████████████████████ | 7568/10000 [00:33<00:10, 229.00it/s]``
``trange(N)`` can be also used as a convenient shortcut for
``tqdm(xrange(N))``.
|Screenshot|
+ Screenshot using `bpython <http://www.bpython-interpreter.org/>`__
It can also be executed as a module with pipes:
@@ -66,10 +66,10 @@ return \r`` and ``line feed \n`` control characters.
Installation
------------
-Latest pypi stable release
+Latest PyPI stable release
~~~~~~~~~~~~~~~~~~~~~~~~~~
-|PyPi-Status|
+|PyPI-Status|
.. code:: sh
@@ -78,7 +78,7 @@ Latest pypi stable release
Latest development release on github
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-|Github-Status| |Github-Stars| |Github-Forks|
+|GitHub-Status| |GitHub-Stars| |GitHub-Forks|
Pull and install in the current directory:
@@ -90,8 +90,8 @@ Pull and install in the current directory:
Changelog
---------
-The list of all changes is available either on Github's Releases:
-|Github-Status| or on crawlers such as
+The list of all changes is available either on GitHub's Releases:
+|GitHub-Status| or on crawlers such as
`allmychanges.com <https://allmychanges.com/p/python/tqdm/>`_.
@@ -195,10 +195,29 @@ Backing up a large directory?
100%|███████████████████████████████▉| 8014/8014 [01:37<00:00, 82.29files/s]
+Help!
+-----
+
+The most common issues relate to excessive output on multiple lines, instead
+of a neat one-line progress bar.
+
+- Consoles in general: require support for carriage return (``CR``, ``\r``).
+- Nested progress bars:
+ * Consoles in general: require support for moving cursors up to the
+ previous line. For example, `IDLE won't work <https://github.com/tqdm/tqdm/issues/191#issuecomment-230168030>`__.
+ * Windows: additionally may require the python module ``colorama``.
+- Wrapping enumerated iterables: use ``enumerate(tqdm(...))`` instead of
+ ``tqdm(enumerate(...))``. The same applies to ``numpy.ndenumerate``.
+ This is because enumerate functions tend to hide the length of iterables.
+ ``tqdm`` does not.
+
+If you come across any other difficulties, browse/open issues
+`here <https://github.com/tqdm/tqdm/issues?q=is%3Aissue>`__.
+
Documentation
-------------
-|PyPi-Versions| |Readme-Hits| (Since 19 May 2016)
+|PyPI-Versions| |README-Hits| (Since 19 May 2016)
.. code:: python
@@ -374,8 +393,11 @@ Returns
Examples and Advanced Usage
---------------------------
-See the `examples <https://github.com/tqdm/tqdm/tree/master/examples>`__
-folder or import the module and run ``help()``.
+- See the `examples <https://github.com/tqdm/tqdm/tree/master/examples>`__
+ folder;
+- import the module and run ``help()``, or
+- consult the `wiki <https://github.com/tqdm/tqdm/wiki>`__.
+ - this has an `excellent article <https://github.com/tqdm/tqdm/wiki/How-to-Make-a-Great-Progressbar>`__ on how to make a **great** progressbar.
Nested progress bars
~~~~~~~~~~~~~~~~~~~~
@@ -472,17 +494,16 @@ for ``DataFrame.progress_apply`` and ``DataFrameGroupBy.progress_apply``:
import pandas as pd
import numpy as np
- from tqdm import tqdm, tqdm_pandas
-
- ...
+ from tqdm import tqdm
df = pd.DataFrame(np.random.randint(0, 100, (100000, 6)))
- # Create and register a new `tqdm` instance with `pandas`
- # (can use tqdm_gui, optional kwargs, etc.)
- tqdm_pandas(tqdm())
+ # Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm`
+ # (can use `tqdm_gui`, `tqdm_notebook`, optional kwargs, etc.)
+ tqdm.pandas(desc="my bar!")
# Now you can use `progress_apply` instead of `apply`
+ # and `progress_map` instead of `map`
df.progress_apply(lambda x: x**2)
# can also groupby:
# df.groupby(0).progress_apply(lambda x: x**2)
@@ -601,167 +622,22 @@ A reusable canonical example is given below:
# After the `with`, printing is restored
print('Done!')
-How to make a good progress bar
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-A good progress bar is a useful progress bar. To be useful, ``tqdm`` displays
-statistics and uses smart algorithms to predict and automagically adapt to
-a variety of use cases with no or minimal configuration.
-
-However, there is one thing that ``tqdm`` cannot do: choose a pertinent
-progress indicator. To display a useful progress bar, it is very important that
-``tqdm`` is supplied with the most pertinent progress indicator.
-This will reflect most accurately the current state of your program.
-Usually, a good way is to preprocess quickly to first evaluate the total amount
-of work to do before beginning the real processing.
-
-To illustrate the importance of a good progress indicator, take the
-following example: you want to walk through all files of a directory and
-process their contents with some external function:
-
-.. code:: python
-
- import os
- from tqdm import tqdm, trange
- from time import sleep
-
- def dosomething(buf):
- """Do something with the content of a file"""
- sleep(0.01)
- pass
-
- def walkdir(folder):
- """Walk through each files in a directory"""
- for dirpath, dirs, files in os.walk(folder):
- for filename in files:
- yield os.path.abspath(os.path.join(dirpath, filename))
-
- def process_content_no_progress(inputpath, blocksize=1024):
- for filepath in walkdir(inputpath):
- with open(filepath, 'rb') as fh:
- buf = 1
- while (buf):
- buf = fh.read(blocksize)
- dosomething(buf)
-
-``process_content_no_progress()`` does the job, but does not show
-any information about the current progress, nor how long it will take.
-
-To quickly fix that using ``tqdm``, we can use this naive approach:
-
-.. code:: python
-
- def process_content_with_progress1(inputpath, blocksize=1024):
- for filepath in tqdm(walkdir(inputpath)):
- with open(filepath, 'rb') as fh:
- buf = 1
- while (buf):
- buf = fh.read(blocksize)
- dosomething(buf)
-
-``process_content_with_progress1()`` will load ``tqdm()``, but since the
-iterator does not provide any length (``os.walkdir()`` does not have a
-``__len__()`` method for the total files count), there is only an indication
-of the current and past program state, no prediction:
-
-``4it [00:03, 2.79it/s]``
-
-The way to get predictive information is to know the total amount of work to be
-done. Since ``os.walkdir()`` cannot give us this information, we need to
-precompute this by ourselves:
-
-.. code:: python
-
- def process_content_with_progress2(inputpath, blocksize=1024):
- # Preprocess the total files count
- filecounter = 0
- for dirpath, dirs, files in tqdm(os.walk(inputpath)):
- for filename in files:
- filecounter += 1
-
- for filepath in tqdm(walkdir(inputpath), total=filecounter):
- with open(filepath, 'rb') as fh:
- buf = 1
- while (buf):
- buf = fh.read(blocksize)
- dosomething(buf)
-
-``process_content_with_progress2()`` is better than the naive approach because
-now we have predictive information:
-
-50%|████████████\ \| 2/4 [00:00<00:00, 4.06it/s]
-
-However, the progress is not smooth: it increments in steps, 1 step being
-1 file processed. The problem is that we do not just walk through files tree,
-but we process the files contents. Thus, if we stumble on one very large file
-which takes a great deal more time to process than other smaller files,
-the progress bar
-will still considers that file is of equal processing weight.
-
-To fix this, we should use another indicator than the files count: the total
-sum of all files sizes. This would be more pertinent since the data we
-process is the files' content, so there is a direct relation between size and
-content.
-
-Below we implement this approach using a manually updated ``tqdm`` bar, where
-``tqdm`` will work on size, while the ``for`` loop works on files paths:
-
-.. code:: python
-
- def process_content_with_progress3(inputpath, blocksize=1024):
- # Preprocess the total files sizes
- sizecounter = 0
- for dirpath, dirs, files in tqdm(os.walk(inputpath)):
- for filename in files:
- fullpath = os.path.abspath(os.path.join(dirpath, filename))
- sizecounter += os.stat(fullpath).st_size
-
- # Load tqdm with size counter instead of files counter
- with tqdm(total=sizecounter, unit='B', unit_scale=True) as pbar:
- for dirpath, dirs, files in os.walk(inputpath):
- for filename in files:
- fullpath = os.path.abspath(os.path.join(dirpath, filename))
- with open(fullpath, 'rb') as fh:
- buf = 1
- while (buf):
- buf = fh.read(blocksize)
- dosomething(buf)
- if buf: pbar.update(len(buf))
-
-And here is the result: a much smoother progress bar with meaningful
-predicted time and statistics:
-
-47%|████████████\ \| 152K/321K [00:03<00:03, 46.2KB/s]
-
Contributions
-------------
-To run the testing suite please make sure tox (https://testrun.org/tox/latest/)
-is installed, then type ``tox`` from the command line.
-
-Where ``tox`` is unavailable, a Makefile-like setup is
-provided with the following command:
-
-.. code:: sh
-
- $ python setup.py make alltests
-
-To see all options, run:
-
-.. code:: sh
-
- $ python setup.py make
+All source code is hosted on `GitHub <https://github.com/tqdm/tqdm>`__.
+Contributions are welcome.
See the
`CONTRIBUTE <https://raw.githubusercontent.com/tqdm/tqdm/master/CONTRIBUTE>`__
file for more information.
-Licence
+LICENCE
-------
-Open Source (OSI approved): |Licence|
+Open Source (OSI approved): |LICENCE|
Citation information: |DOI-URI|
@@ -780,7 +656,7 @@ Ranked by contributions.
`*` Original author
-|Readme-Hits| (Since 19 May 2016)
+|README-Hits| (Since 19 May 2016)
.. |Logo| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/logo.png
.. |Screenshot| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm.gif
@@ -790,23 +666,23 @@ Ranked by contributions.
:target: https://coveralls.io/r/tqdm/tqdm
.. |Branch-Coverage-Status| image:: https://codecov.io/github/tqdm/tqdm/coverage.svg?branch=master
:target: https://codecov.io/github/tqdm/tqdm?branch=master
-.. |Github-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=2592000
+.. |GitHub-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=2592000
:target: https://github.com/tqdm/tqdm/releases
-.. |Github-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg
+.. |GitHub-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg
:target: https://github.com/tqdm/tqdm/network
-.. |Github-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg
+.. |GitHub-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg
:target: https://github.com/tqdm/tqdm/stargazers
-.. |PyPi-Status| image:: https://img.shields.io/pypi/v/tqdm.svg
+.. |PyPI-Status| image:: https://img.shields.io/pypi/v/tqdm.svg
:target: https://pypi.python.org/pypi/tqdm
-.. |PyPi-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg
+.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg
:target: https://pypi.python.org/pypi/tqdm
-.. |PyPi-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg
+.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg
:target: https://pypi.python.org/pypi/tqdm
-.. |Licence| image:: https://img.shields.io/pypi/l/tqdm.svg
+.. |LICENCE| image:: https://img.shields.io/pypi/l/tqdm.svg
:target: https://raw.githubusercontent.com/tqdm/tqdm/master/LICENCE
.. |DOI-URI| image:: https://zenodo.org/badge/21637/tqdm/tqdm.svg
:target: https://zenodo.org/badge/latestdoi/21637/tqdm/tqdm
.. |Screenshot-Jupyter1| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-1.gif
.. |Screenshot-Jupyter2| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-2.gif
.. |Screenshot-Jupyter3| image:: https://raw.githubusercontent.com/tqdm/tqdm/master/images/tqdm-jupyter-3.gif
-.. |Readme-Hits| image:: http://hitt.herokuapp.com/tqdm/tqdm.svg
+.. |README-Hits| image:: http://hitt.herokuapp.com/tqdm/tqdm.svg
diff --git a/examples/pandas_progress_apply.py b/examples/pandas_progress_apply.py
index 84b353f..9c84153 100644
--- a/examples/pandas_progress_apply.py
+++ b/examples/pandas_progress_apply.py
@@ -1,14 +1,15 @@
import pandas as pd
import numpy as np
-from tqdm import tqdm, tqdm_pandas
+from tqdm import tqdm
df = pd.DataFrame(np.random.randint(0, 100, (100000, 6)))
-# Create and register a new `tqdm` instance with `pandas`
-# (can use tqdm_gui, optional kwargs, etc.)
-tqdm_pandas(tqdm())
+# Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm`
+# (can use `tqdm_gui`, `tqdm_notebook`, optional kwargs, etc.)
+tqdm.pandas(desc="my bar!")
# Now you can use `progress_apply` instead of `apply`
+# and `progress_map` instead of `map`
df.progress_apply(lambda x: x**2)
# can also groupby:
# df.groupby(0).progress_apply(lambda x: x**2)
diff --git a/examples/simple_examples.py b/examples/simple_examples.py
index b84cf21..8b29b06 100644
--- a/examples/simple_examples.py
+++ b/examples/simple_examples.py
@@ -1,9 +1,41 @@
"""
-Simple tqdm examples and profiling
+# Simple tqdm examples and profiling
+
+# Benchmark
+for i in _range(int(1e8)):
+ pass
+
+# Basic demo
+import tqdm
+for i in tqdm.trange(int(1e8)):
+ pass
+
+# Some decorations
+import tqdm
+for i in tqdm.trange(int(1e8), miniters=int(1e6), ascii=True,
+ desc="cool", dynamic_ncols=True):
+ pass
+
+# Nested bars
+from tqdm import trange
+for i in trange(10):
+ for j in trange(int(1e7), leave=False, unit_scale=True):
+ pass
+
+# Experimental GUI demo
+import tqdm
+for i in tqdm.tgrange(int(1e8)):
+ pass
+
+# Comparison to https://code.google.com/p/python-progressbar/
+from progressbar.progressbar import ProgressBar
+for i in ProgressBar()(_range(int(1e8))):
+ pass
"""
from time import sleep
from timeit import timeit
+import re
# Simple demo
from tqdm import trange
@@ -11,23 +43,7 @@ for i in trange(16, leave=True):
sleep(0.1)
# Profiling/overhead tests
-stmts = (
- # Benchmark
- 'for i in _range(int(1e8)):\n\tpass',
- # Basic demo
- 'import tqdm\nfor i in tqdm.trange(int(1e8)):\n\tpass',
- # Some decorations
- 'import tqdm\nfor i in tqdm.trange(int(1e8), miniters=int(1e6),'
- ' ascii=True, desc="cool", dynamic_ncols=True):\n\tpass',
- # Nested bars
- 'from tqdm import trange\nfor i in trange(10):\n\t'
- 'for j in trange(int(1e7), leave=False, unit_scale=True):\n\t\tpass',
- # Experimental GUI demo
- 'import tqdm\nfor i in tqdm.tgrange(int(1e8)):\n\tpass',
- # Comparison to https://code.google.com/p/python-progressbar/
- 'from progressbar.progressbar import ProgressBar\n'
- 'for i in ProgressBar()(_range(int(1e8))):\n\tpass')
-
+stmts = filter(None, re.split(r'\n\s*#.*?\n', __doc__))
for s in stmts:
print(s.replace('import tqdm\n', ''))
print(timeit(stmt='try:\n\t_range = xrange'
diff --git a/setup.py b/setup.py
index da931b1..3b880b2 100755
--- a/setup.py
+++ b/setup.py
@@ -7,23 +7,22 @@ try:
except ImportError:
from distutils.core import setup
import sys
-import subprocess
+from subprocess import check_call
+from io import open
+
# For Makefile parsing
import shlex
try: # pragma: no cover
import ConfigParser
import StringIO
except ImportError: # pragma: no cover
- # Python 3 compatibility
import configparser as ConfigParser
import io as StringIO
-import io
import re
""" Makefile auxiliary functions """
-
RE_MAKE_CMD = re.compile('^\t(@\+?)(make)?', flags=re.M)
@@ -38,7 +37,7 @@ def parse_makefile_aliases(filepath):
# -- Parsing the Makefile using ConfigParser
# Adding a fake section to make the Makefile a valid Ini file
ini_str = '[root]\n'
- with io.open(filepath, mode='r') as fd:
+ with open(filepath, mode='r') as fd:
ini_str = ini_str + RE_MAKE_CMD.sub('\t', fd.read())
ini_fp = StringIO.StringIO(ini_str)
# Parse using ConfigParser
@@ -114,16 +113,15 @@ def execute_makefile_commands(commands, alias, verbose=False):
if verbose:
print("Running command: " + cmd)
# Launch the command and wait to finish (synchronized call)
- subprocess.check_call(parsed_cmd)
+ check_call(parsed_cmd)
""" Main setup.py config """
-
# Get version from tqdm/_version.py
__version__ = None
version_file = os.path.join(os.path.dirname(__file__), 'tqdm', '_version.py')
-with io.open(version_file, mode='r') as fd:
+with open(version_file, mode='r') as fd:
exec(fd.read())
# Executing makefile commands if specified
@@ -158,9 +156,8 @@ if sys.argv[1].lower().strip() == 'make':
""" Python package config """
-
README_rst = ''
-with io.open('README.rst', mode='r', encoding='utf-8') as fd:
+with open('README.rst', mode='r', encoding='utf-8') as fd:
README_rst = fd.read()
setup(
diff --git a/tqdm.egg-info/PKG-INFO b/tqdm.egg-info/PKG-INFO
index 12f39a5..95caff0 100644
--- a/tqdm.egg-info/PKG-INFO
+++ b/tqdm.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: tqdm
-Version: 4.7.4
+Version: 4.8.4
Summary: A Fast, Extensible Progress Meter
Home-page: https://github.com/tqdm/tqdm
Author: tqdm developers
@@ -11,17 +11,17 @@ Description: |Logo|
tqdm
====
- |PyPi-Status| |PyPi-Versions|
+ |PyPI-Status| |PyPI-Versions|
|Build-Status| |Coverage-Status| |Branch-Coverage-Status|
- |DOI-URI| |Licence|
+ |DOI-URI| |LICENCE|
``tqdm`` (read taqadum, تقدّم) means "progress" in arabic.
Instantly make your loops show a smart progress meter - just wrap any
- iterable with "tqdm(iterable)", and you're done!
+ iterable with ``tqdm(iterable)``, and you're done!
.. code:: python
@@ -31,13 +31,13 @@ Description: |Logo|
Here's what the output looks like:
- 76%\|████████████████████\ \| 7641/10000 [00:34<00:10,
- 222.22 it/s]
+ ``76%|████████████████████████████ | 7568/10000 [00:33<00:10, 229.00it/s]``
``trange(N)`` can be also used as a convenient shortcut for
``tqdm(xrange(N))``.
|Screenshot|
+ Screenshot using `bpython <http://www.bpython-interpreter.org/>`__
It can also be executed as a module with pipes:
@@ -74,10 +74,10 @@ Description: |Logo|
Installation
------------
- Latest pypi stable release
+ Latest PyPI stable release
~~~~~~~~~~~~~~~~~~~~~~~~~~
- |PyPi-Status|
+ |PyPI-Status|
.. code:: sh
@@ -86,7 +86,7 @@ Description: |Logo|
Latest development release on github
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- |Github-Status| |Github-Stars| |Github-Forks|
+ |GitHub-Status| |GitHub-Stars| |GitHub-Forks|
Pull and install in the current directory:
@@ -98,8 +98,8 @@ Description: |Logo|
Changelog
---------
- The list of all changes is available either on Github's Releases:
- |Github-Status| or on crawlers such as
... 1432 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/tqdm.git
More information about the Python-modules-commits
mailing list