diff -Nru tqdm-4.23.4/CONTRIBUTING.md tqdm-4.28.1/CONTRIBUTING.md --- tqdm-4.23.4/CONTRIBUTING.md 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/CONTRIBUTING.md 2018-10-15 16:02:08.000000000 +0000 @@ -88,7 +88,7 @@ - regularly bump the version number in the file [_version.py](https://raw.githubusercontent.com/tqdm/tqdm/master/tqdm/_version.py) -- follow the [Semantic Versioning](http://semver.org/) convention +- follow the [Semantic Versioning](https://semver.org/) convention - take care of this (instead of users) to avoid PR conflicts solely due to the version file bumping @@ -186,7 +186,7 @@ - ensure that all online CI tests have passed - check `setup.py` and `MANIFEST.in` - which define the packaging -process and info that will be uploaded to [pypi](pypi.python.org) - +process and info that will be uploaded to [pypi](https://pypi.org) - using `[python setup.py] make installdev` ### Tag @@ -225,7 +225,7 @@ ### Notes -- you can also test on the pypi test servers `testpypi.python.org/pypi` +- you can also test on the pypi test servers `test.pypi.org` before the real deployment - in case of a mistake, you can delete an uploaded release on pypi, but you cannot re-upload another with the same version number @@ -242,7 +242,7 @@ - The [main repository site](https://github.com/tqdm/tqdm) which automatically serves the latest README.rst as well as links to all of github's features. This is the preferred online referral link for tqdm. -- The [PyPi mirror](https://pypi.python.org/pypi/tqdm) which automatically +- The [PyPi mirror](https://pypi.org/project/tqdm) which automatically serves the latest release built from README.rst as well as links to past releases. - Many external web crawlers. @@ -271,4 +271,15 @@ 6. `git tag vM.m.p && git push --tags` 7. `[python setup.py] make distclean` 8. `[python setup.py] make build` -9. `[python setup.py] make pypi` +9. upload to PyPI using one of the following: + a) `[python setup.py] make pypi` + b) `twine upload -s -i $(git config user.signingkey) dist/tqdm-*` +10. create new release on https://github.com/tqdm/tqdm/releases + a) add helpful release notes + b) attach dist/tqdm-* binaries (usually only *.whl*) +11. run `make` in the `wiki` submodule to update release notes +12. run `make deploy` in the `docs` submodule to update website +13. accept the automated PR in the `feedstock` submodule to update conda + +The last thee steps require a one-time `make submodules` to clone +`docs`, `wiki`, and `feedstock`. diff -Nru tqdm-4.23.4/debian/changelog tqdm-4.28.1/debian/changelog --- tqdm-4.23.4/debian/changelog 2018-06-08 20:33:14.000000000 +0000 +++ tqdm-4.28.1/debian/changelog 2018-12-25 20:11:24.000000000 +0000 @@ -1,3 +1,20 @@ +tqdm (4.28.1-1) unstable; urgency=medium + + [ Ondřej Nový ] + * Convert git repository from git-dpm to gbp layout + + [ Sandro Tosi ] + * New upstream release + * debian/rules + - new location of manpage + * debian/control + - bump Standards-Version to 4.2.1 (no changes needed) + - add pandas to b-d, needed by tests + * debian/patches/0001-skip-tests.patch + - skip some failing tests + + -- Sandro Tosi Tue, 25 Dec 2018 15:11:24 -0500 + tqdm (4.23.4-1) unstable; urgency=medium [ Ondřej Nový ] diff -Nru tqdm-4.23.4/debian/control tqdm-4.28.1/debian/control --- tqdm-4.23.4/debian/control 2018-06-08 20:33:14.000000000 +0000 +++ tqdm-4.28.1/debian/control 2018-12-25 20:11:24.000000000 +0000 @@ -3,8 +3,8 @@ Priority: optional Maintainer: Sandro Tosi Uploaders: Debian Python Modules Team -Build-Depends: debhelper (>= 9), python, python3, dh-python, python-setuptools, python3-setuptools, python-docopt, python3-docopt, python-nose, python3-nose -Standards-Version: 4.1.4 +Build-Depends: debhelper (>= 9), python, python3, dh-python, python-setuptools, python3-setuptools, python-docopt, python3-docopt, python-nose, python3-nose, python-pandas, python3-pandas +Standards-Version: 4.2.1 Homepage: https://github.com/tqdm/tqdm Vcs-Git: https://salsa.debian.org/python-team/modules/tqdm.git Vcs-Browser: https://salsa.debian.org/python-team/modules/tqdm diff -Nru tqdm-4.23.4/debian/.git-dpm tqdm-4.28.1/debian/.git-dpm --- tqdm-4.23.4/debian/.git-dpm 2018-06-08 20:33:14.000000000 +0000 +++ tqdm-4.28.1/debian/.git-dpm 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -# see git-dpm(1) from git-dpm package -3edc9c3cda1b1ed411f7556927e9da514134572a -3edc9c3cda1b1ed411f7556927e9da514134572a -3edc9c3cda1b1ed411f7556927e9da514134572a -3edc9c3cda1b1ed411f7556927e9da514134572a -tqdm_4.19.5.orig.tar.gz -8605204c7c71902d92e107bbb555ec7102d9cfb1 -99642 diff -Nru tqdm-4.23.4/debian/patches/0001-skip-tests.patch tqdm-4.28.1/debian/patches/0001-skip-tests.patch --- tqdm-4.23.4/debian/patches/0001-skip-tests.patch 1970-01-01 00:00:00.000000000 +0000 +++ tqdm-4.28.1/debian/patches/0001-skip-tests.patch 2018-12-25 20:11:24.000000000 +0000 @@ -0,0 +1,45 @@ +--- a/tqdm/tests/tests_synchronisation.py ++++ b/tqdm/tests/tests_synchronisation.py +@@ -171,6 +171,8 @@ def test_monitoring_multi(): + @with_setup(pretest, posttest) + def test_imap(): + """Test multiprocessing.Pool""" ++ # https://github.com/tqdm/tqdm/issues/654 ++ raise SkipTest + try: + from multiprocessing import Pool + except ImportError: +--- a/tqdm/tests/tests_main.py ++++ b/tqdm/tests/tests_main.py +@@ -94,18 +94,19 @@ def test_main(): + except SystemExit: + pass + +- # test --manpath +- tmp = mkdtemp() +- man = path.join(tmp, "tqdm.1") +- assert not path.exists(man) +- try: +- main(argv=['--manpath', tmp]) +- except SystemExit: +- pass +- else: +- raise SystemExit("Expected system exit") +- assert path.exists(man) +- rmtree(tmp, True) ++ # https://github.com/tqdm/tqdm/issues/655 ++ ## test --manpath ++ #tmp = mkdtemp() ++ #man = path.join(tmp, "tqdm.1") ++ #assert not path.exists(man) ++ #try: ++ # main(argv=['--manpath', tmp]) ++ #except SystemExit: ++ # pass ++ #else: ++ # raise SystemExit("Expected system exit") ++ #assert path.exists(man) ++ #rmtree(tmp, True) + + # test --log + with closing(StringIO()) as sys.stdin: diff -Nru tqdm-4.23.4/debian/patches/series tqdm-4.28.1/debian/patches/series --- tqdm-4.23.4/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ tqdm-4.28.1/debian/patches/series 2018-12-25 20:11:24.000000000 +0000 @@ -0,0 +1 @@ +0001-skip-tests.patch diff -Nru tqdm-4.23.4/debian/rules tqdm-4.28.1/debian/rules --- tqdm-4.23.4/debian/rules 2018-06-08 20:33:14.000000000 +0000 +++ tqdm-4.28.1/debian/rules 2018-12-25 20:11:24.000000000 +0000 @@ -34,7 +34,7 @@ rm -rf $(CURDIR)/debian/*/usr/man override_dh_installman: - dh_installman -ppython3-tqdm tqdm.1 + dh_installman -ppython3-tqdm tqdm/tqdm.1 override_dh_installdocs: dh_installdocs -A CONTRIBUTING.md README.rst diff -Nru tqdm-4.23.4/Makefile tqdm-4.28.1/Makefile --- tqdm-4.23.4/Makefile 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/Makefile 2018-10-21 18:47:09.000000000 +0000 @@ -30,7 +30,6 @@ installdev install build - pypimeta pypi none @@ -86,7 +85,7 @@ asv publish asv preview -tqdm.1: tqdm.1.md +tqdm/tqdm.1: .tqdm.1.md python -m tqdm --help | tail -n+5 | cat "$<" - |\ sed -r 's/^ (--.*)=<(.*)> : (.*)$$/\n\\\1=*\2*\n: \3./' |\ sed -r 's/ (-.*, --.*) /\n\1\n: /' |\ @@ -116,17 +115,19 @@ installdev: python setup.py develop --uninstall python setup.py develop +submodules: + git clone git@github.com:tqdm/tqdm.wiki wiki + git clone git@github.com:tqdm/tqdm.github.io docs + git clone git@github.com:conda-forge/tqdm-feedstock feedstock + cd feedstock && git remote add autotick-bot git@github.com:regro-cf-autotick-bot/tqdm-feedstock install: python setup.py install build: @make prebuildclean - python setup.py sdist --formats=gztar,zip bdist_wheel - python setup.py bdist_wininst - -pypimeta: - python setup.py register + python setup.py sdist bdist_wheel + # python setup.py bdist_wininst pypi: twine upload dist/* @@ -134,7 +135,6 @@ buildupload: @make testsetup @make build - @make pypimeta @make pypi none: diff -Nru tqdm-4.23.4/MANIFEST.in tqdm-4.28.1/MANIFEST.in --- tqdm-4.23.4/MANIFEST.in 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/MANIFEST.in 2018-10-21 18:47:09.000000000 +0000 @@ -10,7 +10,11 @@ # Test suite recursive-include tqdm/tests *.py +# Sub-packages +recursive-include tqdm/autonotebook *.py +recursive-include tqdm/auto *.py + # Examples/Documentation recursive-include examples *.py include README.rst -include tqdm.1 +include tqdm/tqdm.1 diff -Nru tqdm-4.23.4/PKG-INFO tqdm-4.28.1/PKG-INFO --- tqdm-4.23.4/PKG-INFO 2018-05-22 19:06:50.000000000 +0000 +++ tqdm-4.28.1/PKG-INFO 2018-10-21 19:37:30.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: tqdm -Version: 4.23.4 +Version: 4.28.1 Summary: Fast, Extensible Progress Meter Home-page: https://github.com/tqdm/tqdm Author: Noam Yorav-Raphael @@ -21,7 +21,7 @@ ``tqdm`` means "progress" in Arabic (taqadum, تقدّم) - and an abbreviation for "I love you so much" in Spanish (te quiero demasiado). + and is an abbreviation for "I love you so much" in Spanish (te quiero demasiado). Instantly make your loops show a smart progress meter - just wrap any iterable with ``tqdm(iterable)``, and you're done! @@ -276,7 +276,7 @@ maxinterval=10.0, miniters=None, ascii=None, disable=False, unit='it', unit_scale=False, dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, position=None, - postfix=None): + postfix=None, unit_divisor=1000): Parameters ~~~~~~~~~~ @@ -287,7 +287,7 @@ * desc : str, optional Prefix for the progressbar. * total : int, optional - The number of expected iterations. If (default: None), + The number of expected iterations. If unspecified, len(iterable) is used if possible. As a last resort, only basic progress statistics are displayed (no ETA, no progressbar). If ``gui`` is True and this parameter needs subsequent updating, @@ -307,9 +307,9 @@ fallback is a meter width of 10 and no limit for the counter and statistics. If 0, will not print any meter (only stats). * mininterval : float, optional - Minimum progress display update interval, in seconds [default: 0.1]. + Minimum progress display update interval [default: 0.1] seconds. * maxinterval : float, optional - Maximum progress display update interval, in seconds [default: 10]. + Maximum progress display update interval [default: 10] seconds. Automatically adjusts ``miniters`` to correspond to ``mininterval`` after long display update lag. Only works if ``dynamic_miniters`` or monitor thread is enabled. @@ -326,7 +326,7 @@ the meter. The fallback is to use ASCII characters ``1-9 #``. * disable : bool, optional Whether to disable the entire progressbar wrapper - [default: False]. + [default: False]. If set to None, disable on non-TTY. * unit : str, optional String that will be used to define the unit of each iteration [default: it]. @@ -675,6 +675,19 @@ |Screenshot-Jupyter2| |Screenshot-Jupyter3| + It is also possible to let ``tqdm`` automatically choose between + console or notebook versions by using the ``autonotebook`` submodule: + + .. code:: python + + from tqdm.autonotebook import tqdm + tqdm.pandas() + + Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook + since it is not meant to be possible to distinguish between ``jupyter notebook`` + and ``jupyter console``. Use ``auto`` instead of ``autonotebook`` to suppress + this warning. + Writing messages ~~~~~~~~~~~~~~~~ @@ -808,6 +821,12 @@ `CONTRIBUTING `__ file for more information. + Ports to Other Languages + ~~~~~~~~~~~~~~~~~~~~~~~~ + + A list is available on + `this wiki page `__. + LICENCE ------- @@ -820,12 +839,13 @@ Authors ------- - The main developers, ranked by surviving lines of code, are: + The main developers, ranked by surviving lines of code + (`git fame -wMC `__), are: - Casper da Costa-Luis (`casperdcl `__, ~2/3, |Gift-Casper|) - - Stephen Larroque (`lrq3000 `__, ~1/3) + - Stephen Larroque (`lrq3000 `__, ~1/5) + - Hadrien Mary (`hadim `__, ~2%) - Guangshuo Chen (`chengs `__, ~1%) - - Hadrien Mary (`hadim `__, ~1%) - Noam Yorav-Raphael (`noamraph `__, ~1%, original author) - Mikhail Korobov (`kmike `__, ~1%) @@ -860,11 +880,11 @@ .. |Gift-Casper| image:: https://img.shields.io/badge/gift-donate-ff69b4.svg :target: https://caspersci.uk.to/donate.html .. |PyPI-Status| image:: https://img.shields.io/pypi/v/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |Conda-Forge-Status| image:: https://anaconda.org/conda-forge/tqdm/badges/version.svg :target: https://anaconda.org/conda-forge/tqdm .. |OpenHub-Status| image:: https://www.openhub.net/p/tqdm/widgets/project_thin_badge?format=gif diff -Nru tqdm-4.23.4/README.rst tqdm-4.28.1/README.rst --- tqdm-4.23.4/README.rst 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/README.rst 2018-10-20 21:13:56.000000000 +0000 @@ -11,7 +11,7 @@ ``tqdm`` means "progress" in Arabic (taqadum, تقدّم) -and an abbreviation for "I love you so much" in Spanish (te quiero demasiado). +and is an abbreviation for "I love you so much" in Spanish (te quiero demasiado). Instantly make your loops show a smart progress meter - just wrap any iterable with ``tqdm(iterable)``, and you're done! @@ -266,7 +266,7 @@ maxinterval=10.0, miniters=None, ascii=None, disable=False, unit='it', unit_scale=False, dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, position=None, - postfix=None): + postfix=None, unit_divisor=1000): Parameters ~~~~~~~~~~ @@ -277,7 +277,7 @@ * desc : str, optional Prefix for the progressbar. * total : int, optional - The number of expected iterations. If (default: None), + The number of expected iterations. If unspecified, len(iterable) is used if possible. As a last resort, only basic progress statistics are displayed (no ETA, no progressbar). If ``gui`` is True and this parameter needs subsequent updating, @@ -297,9 +297,9 @@ fallback is a meter width of 10 and no limit for the counter and statistics. If 0, will not print any meter (only stats). * mininterval : float, optional - Minimum progress display update interval, in seconds [default: 0.1]. + Minimum progress display update interval [default: 0.1] seconds. * maxinterval : float, optional - Maximum progress display update interval, in seconds [default: 10]. + Maximum progress display update interval [default: 10] seconds. Automatically adjusts ``miniters`` to correspond to ``mininterval`` after long display update lag. Only works if ``dynamic_miniters`` or monitor thread is enabled. @@ -316,7 +316,7 @@ the meter. The fallback is to use ASCII characters ``1-9 #``. * disable : bool, optional Whether to disable the entire progressbar wrapper - [default: False]. + [default: False]. If set to None, disable on non-TTY. * unit : str, optional String that will be used to define the unit of each iteration [default: it]. @@ -665,6 +665,19 @@ |Screenshot-Jupyter2| |Screenshot-Jupyter3| +It is also possible to let ``tqdm`` automatically choose between +console or notebook versions by using the ``autonotebook`` submodule: + +.. code:: python + + from tqdm.autonotebook import tqdm + tqdm.pandas() + +Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook +since it is not meant to be possible to distinguish between ``jupyter notebook`` +and ``jupyter console``. Use ``auto`` instead of ``autonotebook`` to suppress +this warning. + Writing messages ~~~~~~~~~~~~~~~~ @@ -798,6 +811,12 @@ `CONTRIBUTING `__ file for more information. +Ports to Other Languages +~~~~~~~~~~~~~~~~~~~~~~~~ + +A list is available on +`this wiki page `__. + LICENCE ------- @@ -810,12 +829,13 @@ Authors ------- -The main developers, ranked by surviving lines of code, are: +The main developers, ranked by surviving lines of code +(`git fame -wMC `__), are: - Casper da Costa-Luis (`casperdcl `__, ~2/3, |Gift-Casper|) -- Stephen Larroque (`lrq3000 `__, ~1/3) +- Stephen Larroque (`lrq3000 `__, ~1/5) +- Hadrien Mary (`hadim `__, ~2%) - Guangshuo Chen (`chengs `__, ~1%) -- Hadrien Mary (`hadim `__, ~1%) - Noam Yorav-Raphael (`noamraph `__, ~1%, original author) - Mikhail Korobov (`kmike `__, ~1%) @@ -850,11 +870,11 @@ .. |Gift-Casper| image:: https://img.shields.io/badge/gift-donate-ff69b4.svg :target: https://caspersci.uk.to/donate.html .. |PyPI-Status| image:: https://img.shields.io/pypi/v/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |Conda-Forge-Status| image:: https://anaconda.org/conda-forge/tqdm/badges/version.svg :target: https://anaconda.org/conda-forge/tqdm .. |OpenHub-Status| image:: https://www.openhub.net/p/tqdm/widgets/project_thin_badge?format=gif diff -Nru tqdm-4.23.4/setup.py tqdm-4.28.1/setup.py --- tqdm-4.23.4/setup.py 2018-05-22 19:02:36.000000000 +0000 +++ tqdm-4.28.1/setup.py 2018-10-21 17:50:34.000000000 +0000 @@ -3,9 +3,15 @@ import os try: - from setuptools import setup + from setuptools import setup, find_packages except ImportError: from distutils.core import setup + + def find_packages(where='.'): + # os.walk -> list[(dirname, list[subdirs], list[files])] + return [folder.replace("/", ".").lstrip(".") + for (folder, _, fils) in os.walk(where) + if "__init__.py" in fils] import sys from subprocess import check_call from io import open as io_open @@ -23,7 +29,8 @@ # Get version from tqdm/_version.py __version__ = None -version_file = os.path.join(os.path.dirname(__file__), 'tqdm', '_version.py') +src_dir = os.path.abspath(os.path.dirname(__file__)) +version_file = os.path.join(src_dir, 'tqdm', '_version.py') with io_open(version_file, mode='r') as fd: exec(fd.read()) @@ -119,8 +126,7 @@ if verbose: print("Running command: " + cmd) # Launch the command and wait to finish (synchronized call) - check_call(parsed_cmd, - cwd=os.path.dirname(os.path.abspath(__file__))) + check_call(parsed_cmd, cwd=src_dir) # Main setup.py config # @@ -129,7 +135,7 @@ # Executing makefile commands if specified if sys.argv[1].lower().strip() == 'make': # Filename of the makefile - fpath = os.path.join(os.path.dirname(__file__), 'Makefile') + fpath = os.path.join(src_dir, 'Makefile') # Parse the makefile, substitute the aliases and extract the commands commands = parse_makefile_aliases(fpath) @@ -159,7 +165,7 @@ # Python package config # README_rst = '' -fndoc = os.path.join(os.path.dirname(__file__), 'README.rst') +fndoc = os.path.join(src_dir, 'README.rst') with io_open(fndoc, mode='r', encoding='utf-8') as fd: README_rst = fd.read() @@ -174,15 +180,15 @@ maintainer='tqdm developers', maintainer_email='python.tqdm@gmail.com', platforms=['any'], - packages=['tqdm'], + packages=['tqdm'] + ['tqdm.' + i for i in find_packages('tqdm')], entry_points={'console_scripts': ['tqdm=tqdm._main:main'], }, - data_files=[('man/man1', ['tqdm.1'])], - package_data={'': ['CONTRIBUTING.md', 'LICENCE', 'examples/*.py']}, + package_data={'tqdm': ['CONTRIBUTING.md', 'LICENCE', 'examples/*.py', + 'tqdm.1']}, long_description=README_rst, python_requires='>=2.6, !=3.0.*, !=3.1.*', classifiers=[ # Trove classifiers - # (https://pypi.python.org/pypi?%3Aaction=list_classifiers) + # (https://pypi.org/pypi?%3Aaction=list_classifiers) 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Environment :: MacOS X', diff -Nru tqdm-4.23.4/tox.ini tqdm-4.28.1/tox.ini --- tqdm-4.23.4/tox.ini 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/tox.ini 2018-10-15 16:09:30.000000000 +0000 @@ -1,4 +1,4 @@ -# Tox (http://tox.testrun.org/) is a tool for running tests +# Tox (https://tox.testrun.org/) is a tool for running tests # in multiple virtualenvs. This configuration file will run the # test suite on all supported python versions. To use it, "pip install tox" # and then run "tox" from this directory. @@ -39,11 +39,15 @@ - coveralls codecov -# no cython/numpy/pandas for py{py,py3,26,33,37} +# no cython/numpy/pandas for py{py,py3,26,33,34} [testenv:py26] # no codecov and timer for py26 -deps = {[coverage]deps} +deps = + nose + coverage + coveralls==1.2.0 + pycparser==2.18 commands = {[coverage]commands} [testenv:pypy] @@ -60,13 +64,6 @@ [testenv:py34] # py34-compatible pandas -deps = - {[extra]deps} - cython - numpy - pandas<0.21 - -[testenv:py37] deps = {[extra]deps} commands = {[extra]commands} diff -Nru tqdm-4.23.4/tqdm/auto/__init__.py tqdm-4.28.1/tqdm/auto/__init__.py --- tqdm-4.23.4/tqdm/auto/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ tqdm-4.28.1/tqdm/auto/__init__.py 2018-10-15 16:09:30.000000000 +0000 @@ -0,0 +1,6 @@ +import warnings +from .._tqdm import TqdmExperimentalWarning +with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=TqdmExperimentalWarning) + from ..autonotebook import tqdm, trange +__all__ = ["tqdm", "trange"] diff -Nru tqdm-4.23.4/tqdm/autonotebook/__init__.py tqdm-4.28.1/tqdm/autonotebook/__init__.py --- tqdm-4.23.4/tqdm/autonotebook/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ tqdm-4.28.1/tqdm/autonotebook/__init__.py 2018-09-26 23:10:21.000000000 +0000 @@ -0,0 +1,15 @@ +try: + from IPython import get_ipython + if 'IPKernelApp' not in get_ipython().config: # pragma: no cover + raise ImportError("console") +except: + from .._tqdm import tqdm, trange +else: # pragma: no cover + from .._tqdm_notebook import tqdm_notebook as tqdm + from .._tqdm_notebook import tnrange as trange + from .._tqdm import TqdmExperimentalWarning + from warnings import warn + warn("Using `tqdm.autonotebook.tqdm` in notebook mode." + " Use `tqdm.tqdm` instead to force console mode" + " (e.g. in jupyter console)", TqdmExperimentalWarning) +__all__ = ["tqdm", "trange"] diff -Nru tqdm-4.23.4/tqdm/_main.py tqdm-4.28.1/tqdm/_main.py --- tqdm-4.23.4/tqdm/_main.py 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/tqdm/_main.py 2018-10-21 18:47:09.000000000 +0000 @@ -109,25 +109,30 @@ bytes : bool, optional If true, will count bytes, ignore `delim`, and default `unit_scale` to True, `unit_divisor` to 1024, and `unit` to 'B'. + manpath : str, optional + Directory in which to install tqdm man pages. log : str, optional CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET. """ -def main(fp=sys.stderr): +def main(fp=sys.stderr, argv=None): """ Paramters (internal use only) --------- fp : file-like object for tqdm + argv : list (default: sys.argv[1:]) """ + if argv is None: + argv = sys.argv[1:] try: - log = sys.argv.index('--log') + log = argv.index('--log') except ValueError: logLevel = 'INFO' else: - # sys.argv.pop(log) - # logLevel = sys.argv.pop(log) - logLevel = sys.argv[log + 1] + # argv.pop(log) + # logLevel = argv.pop(log) + logLevel = argv[log + 1] logging.basicConfig( level=getattr(logging, logLevel), format="%(levelname)s:%(module)s:%(lineno)d:%(message)s") @@ -159,14 +164,14 @@ """ + d.strip('\n') + '\n' # opts = docopt(d, version=__version__) - if any(v in sys.argv for v in ('-v', '--version')): + if any(v in argv for v in ('-v', '--version')): sys.stdout.write(__version__ + '\n') sys.exit(0) - elif any(v in sys.argv for v in ('-h', '--help')): + elif any(v in argv for v in ('-h', '--help')): sys.stdout.write(d + '\n') sys.exit(0) - argv = RE_SHLEX.split(' '.join(["tqdm"] + sys.argv[1:])) + argv = RE_SHLEX.split(' '.join(["tqdm"] + argv)) opts = dict(zip(argv[1::2], argv[2::2])) log.debug(opts) @@ -189,6 +194,16 @@ buf_size = tqdm_args.pop('buf_size', 256) delim = tqdm_args.pop('delim', '\n') delim_per_char = tqdm_args.pop('bytes', False) + manpath = tqdm_args.pop('manpath', None) + if manpath is not None: + from os import path + from shutil import copyfile + from pkg_resources import resource_filename, Requirement + fi = resource_filename(Requirement.parse('tqdm'), 'tqdm/tqdm.1') + fo = path.join(manpath, 'tqdm.1') + copyfile(fi, fo) + log.info("written:" + fo) + sys.exit(0) if delim_per_char: tqdm_args.setdefault('unit', 'B') tqdm_args.setdefault('unit_scale', True) diff -Nru tqdm-4.23.4/tqdm/_monitor.py tqdm-4.28.1/tqdm/_monitor.py --- tqdm-4.23.4/tqdm/_monitor.py 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/tqdm/_monitor.py 2018-09-26 23:10:21.000000000 +0000 @@ -1,6 +1,7 @@ from threading import Event, Thread from time import time from warnings import warn +import atexit __all__ = ["TMonitor", "TqdmSynchronisationWarning"] @@ -43,6 +44,7 @@ self._event = TMonitor._event else: self._event = Event + atexit.register(self.exit) self.start() def exit(self): diff -Nru tqdm-4.23.4/tqdm/tests/tests_main.py tqdm-4.28.1/tqdm/tests/tests_main.py --- tqdm-4.23.4/tqdm/tests/tests_main.py 2018-05-22 19:02:36.000000000 +0000 +++ tqdm-4.28.1/tqdm/tests/tests_main.py 2018-10-21 18:47:09.000000000 +0000 @@ -1,5 +1,8 @@ import sys import subprocess +from os import path +from shutil import rmtree +from tempfile import mkdtemp from tqdm import main, TqdmKeyError, TqdmTypeError from tests_tqdm import with_setup, pretest, posttest, _range, closing, \ @@ -83,6 +86,7 @@ else: raise TqdmTypeError('invalid_int_value') + # test SystemExits for i in ('-h', '--help', '-v', '--version'): sys.argv = ['', i] try: @@ -90,5 +94,26 @@ except SystemExit: pass + # test --manpath + tmp = mkdtemp() + man = path.join(tmp, "tqdm.1") + assert not path.exists(man) + try: + main(argv=['--manpath', tmp]) + except SystemExit: + pass + else: + raise SystemExit("Expected system exit") + assert path.exists(man) + rmtree(tmp, True) + + # test --log + with closing(StringIO()) as sys.stdin: + sys.stdin.write('\0'.join(map(str, _range(int(1e3))))) + sys.stdin.seek(0) + # with closing(UnicodeIO()) as fp: + main(argv=['--log', 'DEBUG']) + # assert "DEBUG:" in sys.stdout.getvalue() + # clean up sys.stdin, sys.argv = _SYS diff -Nru tqdm-4.23.4/tqdm/tests/tests_pandas.py tqdm-4.28.1/tqdm/tests/tests_pandas.py --- tqdm-4.23.4/tqdm/tests/tests_pandas.py 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/tqdm/tests/tests_pandas.py 2018-10-15 16:02:08.000000000 +0000 @@ -33,12 +33,12 @@ tqdm.pandas(file=our_file, leave=True, ascii=True) series = pd.Series(randint(0, 50, (123,))) - res1 = series.rolling(10).progress_apply(lambda x: 1) - res2 = series.rolling(10).apply(lambda x: 1) + res1 = series.rolling(10).progress_apply(lambda x: 1, raw=True) + res2 = series.rolling(10).apply(lambda x: 1, raw=True) assert res1.equals(res2) - res3 = series.expanding(10).progress_apply(lambda x: 2) - res4 = series.expanding(10).apply(lambda x: 2) + res3 = series.expanding(10).progress_apply(lambda x: 2, raw=True) + res4 = series.expanding(10).apply(lambda x: 2, raw=True) assert res3.equals(res4) expects = ['114it'] # 123-10+1 @@ -104,7 +104,7 @@ assert res1.equals(res2) # apply - for axis in [0, 1]: + for axis in [0, 1, 'index', 'columns']: res3 = df.progress_apply(task_func, axis=axis) res4 = df.apply(task_func, axis=axis) assert res3.equals(res4) diff -Nru tqdm-4.23.4/tqdm/tests/tests_tqdm.py tqdm-4.28.1/tqdm/tests/tests_tqdm.py --- tqdm-4.23.4/tqdm/tests/tests_tqdm.py 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/tqdm/tests/tests_tqdm.py 2018-10-15 16:09:30.000000000 +0000 @@ -209,6 +209,15 @@ assert format_interval(238113) == '66:08:33' +def test_format_num(): + """Test number format""" + format_num = tqdm.format_num + + assert float(format_num(1337)) == 1337 + assert format_num(int(1e6)) == '1e+6' + assert format_num(1239876) == '1''239''876' + + def test_format_meter(): """Test statistics and progress bar formatting""" try: @@ -255,6 +264,19 @@ unich(0x258f) + "|test" +def test_ansi_escape_codes(): + """Test stripping of ANSI escape codes""" + format_meter = tqdm.format_meter + ansi = {'BOLD': '\033[1m', + 'RED': '\033[91m', + 'END': '\033[0m'} + desc = '{BOLD}{RED}Colored{END} description'.format(**ansi) + ncols = 123 + ansi_len = sum([len(code) for code in ansi.values()]) + meter = format_meter(0, 100, 0, ncols=ncols, prefix=desc) + assert len(meter) == ncols + ansi_len + + def test_si_format(): """Test SI unit prefixes""" format_meter = tqdm.format_meter @@ -1558,3 +1580,54 @@ else: tqdm.set_lock(mp_lock) # TODO: test interleaved output #445 + + +@with_setup(pretest, posttest) +def test_bool(): + """Test boolean cast""" + def internal(our_file, disable): + with tqdm(total=10, file=our_file, disable=disable) as t: + assert t + with tqdm(total=0, file=our_file, disable=disable) as t: + assert not t + with trange(10, file=our_file, disable=disable) as t: + assert t + with trange(0, file=our_file, disable=disable) as t: + assert not t + with tqdm([], file=our_file, disable=disable) as t: + assert not t + with tqdm([0], file=our_file, disable=disable) as t: + assert t + with tqdm(file=our_file, disable=disable) as t: + try: + print(bool(t)) + except TypeError: + pass + else: + raise TypeError( + "Expected tqdm() with neither total nor iterable to fail") + + # test with and without disable + with closing(StringIO()) as our_file: + internal(our_file, False) + internal(our_file, True) + + +def backendCheck(module): + """Test tqdm-like module fallback""" + tn = module.tqdm + tr = module.trange + + with closing(StringIO()) as our_file: + with tn(total=10, file=our_file) as t: + assert len(t) == 10 + with tr(1337) as t: + assert len(t) == 1337 + + +@with_setup(pretest, posttest) +def test_auto(): + """Test auto fallback""" + from tqdm import autonotebook, auto + backendCheck(autonotebook) + backendCheck(auto) diff -Nru tqdm-4.23.4/tqdm/tqdm.1 tqdm-4.28.1/tqdm/tqdm.1 --- tqdm-4.23.4/tqdm/tqdm.1 1970-01-01 00:00:00.000000000 +0000 +++ tqdm-4.28.1/tqdm/tqdm.1 2018-10-21 18:47:09.000000000 +0000 @@ -0,0 +1,236 @@ +.\" Automatically generated by Pandoc 1.19.2.1 +.\" +.TH "TQDM" "1" "2015\-2018" "tqdm User Manuals" "" +.hy +.SH NAME +.PP +tqdm \- fast, extensible progress bar for Python and CLI +.SH SYNOPSIS +.PP +tqdm [\f[I]options\f[]] +.SH DESCRIPTION +.PP +See . +Can be used as a pipe: +.IP +.nf +\f[C] +$\ #\ count\ lines\ of\ code +$\ cat\ *.py\ |\ tqdm\ |\ wc\ \-l +327it\ [00:00,\ 981773.38it/s] +327 + +$\ #\ find\ all\ files +$\ find\ .\ \-name\ "*.py"\ |\ tqdm\ |\ wc\ \-l +432it\ [00:00,\ 833842.30it/s] +432 + +#\ ...\ and\ more\ info +$\ find\ .\ \-name\ \[aq]*.py\[aq]\ \-exec\ wc\ \-l\ \\{}\ \\;\ \\ +\ \ |\ tqdm\ \-\-total\ 432\ \-\-unit\ files\ \-\-desc\ counting\ \\ +\ \ |\ awk\ \[aq]{\ sum\ +=\ $1\ };\ END\ {\ print\ sum\ }\[aq] +counting:\ 100%|█████████|\ 432/432\ [00:00<00:00,\ 794361.83files/s] +131998 +\f[] +.fi +.SH OPTIONS +.TP +.B \-h, \-\-help +Print this help and exit +.RS +.RE +.TP +.B \-v, \-\-version +Print version and exit +.RS +.RE +.TP +.B \-\-desc=\f[I]desc\f[] +str, optional. +Prefix for the progressbar. +.RS +.RE +.TP +.B \-\-total=\f[I]total\f[] +int, optional. +The number of expected iterations. +If unspecified, len(iterable) is used if possible. +As a last resort, only basic progress statistics are displayed (no ETA, +no progressbar). +If \f[C]gui\f[] is True and this parameter needs subsequent updating, +specify an initial arbitrary large positive integer, e.g. +int(9e9). +.RS +.RE +.TP +.B \-\-leave=\f[I]leave\f[] +bool, optional. +If [default: True], keeps all traces of the progressbar upon termination +of iteration. +.RS +.RE +.TP +.B \-\-ncols=\f[I]ncols\f[] +int, optional. +The width of the entire output message. +If specified, dynamically resizes the progressbar to stay within this +bound. +If unspecified, attempts to use environment width. +The fallback is a meter width of 10 and no limit for the counter and +statistics. +If 0, will not print any meter (only stats). +.RS +.RE +.TP +.B \-\-mininterval=\f[I]mininterval\f[] +float, optional. +Minimum progress display update interval [default: 0.1] seconds. +.RS +.RE +.TP +.B \-\-maxinterval=\f[I]maxinterval\f[] +float, optional. +Maximum progress display update interval [default: 10] seconds. +Automatically adjusts \f[C]miniters\f[] to correspond to +\f[C]mininterval\f[] after long display update lag. +Only works if \f[C]dynamic_miniters\f[] or monitor thread is enabled. +.RS +.RE +.TP +.B \-\-miniters=\f[I]miniters\f[] +int, optional. +Minimum progress display update interval, in iterations. +If 0 and \f[C]dynamic_miniters\f[], will automatically adjust to equal +\f[C]mininterval\f[] (more CPU efficient, good for tight loops). +If > 0, will skip display of specified number of iterations. +Tweak this and \f[C]mininterval\f[] to get very efficient loops. +If your progress is erratic with both fast and slow iterations (network, +skipping items, etc) you should set miniters=1. +.RS +.RE +.TP +.B \-\-ascii=\f[I]ascii\f[] +bool, optional. +If unspecified or False, use unicode (smooth blocks) to fill the meter. +The fallback is to use ASCII characters \f[C]1\-9\ #\f[]. +.RS +.RE +.TP +.B \-\-disable=\f[I]disable\f[] +bool, optional. +Whether to disable the entire progressbar wrapper [default: False]. +If set to None, disable on non\-TTY. +.RS +.RE +.TP +.B \-\-unit=\f[I]unit\f[] +str, optional. +String that will be used to define the unit of each iteration [default: +it]. +.RS +.RE +.TP +.B \-\-unit_scale=\f[I]unit_scale\f[] +bool or int or float, optional. +If 1 or True, the number of iterations will be reduced/scaled +automatically and a metric prefix following the International System of +Units standard will be added (kilo, mega, etc.) [default: False]. +If any other non\-zero number, will scale \f[C]total\f[] and \f[C]n\f[]. +.RS +.RE +.TP +.B \-\-dynamic_ncols=\f[I]dynamic_ncols\f[] +bool, optional. +If set, constantly alters \f[C]ncols\f[] to the environment (allowing +for window resizes) [default: False]. +.RS +.RE +.TP +.B \-\-smoothing=\f[I]smoothing\f[] +float, optional. +Exponential moving average smoothing factor for speed estimates (ignored +in GUI mode). +Ranges from 0 (average speed) to 1 (current/instantaneous speed) +[default: 0.3]. +.RS +.RE +.TP +.B \-\-bar_format=\f[I]bar_format\f[] +str, optional. +Specify a custom bar string formatting. +May impact performance. +[default: \[aq]{l_bar}{bar}{r_bar}\[aq]], where l_bar=\[aq]{desc}: +{percentage:3.0f}%|\[aq] and r_bar=\[aq]| {n_fmt}/{total_fmt} +[{elapsed}<{remaining}, \[aq] \[aq]{rate_fmt}{postfix}]\[aq] Possible +vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, percentage, rate, +rate_fmt, rate_noinv, rate_noinv_fmt, rate_inv, rate_inv_fmt, elapsed, +remaining, desc, postfix. +Note that a trailing ": " is automatically removed after {desc} if the +latter is empty. +.RS +.RE +.TP +.B \-\-initial=\f[I]initial\f[] +int, optional. +The initial counter value. +Useful when restarting a progress bar [default: 0]. +.RS +.RE +.TP +.B \-\-position=\f[I]position\f[] +int, optional. +Specify the line offset to print this bar (starting from 0) Automatic if +unspecified. +Useful to manage multiple bars at once (eg, from threads). +.RS +.RE +.TP +.B \-\-postfix=\f[I]postfix\f[] +dict or *, optional. +Specify additional stats to display at the end of the bar. +Calls \f[C]set_postfix(**postfix)\f[] if possible (dict). +.RS +.RE +.TP +.B \-\-unit_divisor=\f[I]unit_divisor\f[] +float, optional. +[default: 1000], ignored unless \f[C]unit_scale\f[] is True. +.RS +.RE +.TP +.B \-\-delim=\f[I]delim\f[] +chr, optional. +Delimiting character [default: \[aq]\[aq]]. +Use \[aq]\[aq] for null. +N.B.: on Windows systems, Python converts \[aq]\[aq] to \[aq]\[aq]. +.RS +.RE +.TP +.B \-\-buf_size=\f[I]buf_size\f[] +int, optional. +String buffer size in bytes [default: 256] used when \f[C]delim\f[] is +specified. +.RS +.RE +.TP +.B \-\-bytes=\f[I]bytes\f[] +bool, optional. +If true, will count bytes, ignore \f[C]delim\f[], and default +\f[C]unit_scale\f[] to True, \f[C]unit_divisor\f[] to 1024, and +\f[C]unit\f[] to \[aq]B\[aq]. +.RS +.RE +.TP +.B \-\-manpath=\f[I]manpath\f[] +str, optional. +Directory in which to install tqdm man pages. +.RS +.RE +.TP +.B \-\-log=\f[I]log\f[] +str, optional. +CRITICAL|FATAL|ERROR|WARN(ING)|[default: \[aq]INFO\[aq]]|DEBUG|NOTSET. +.RS +.RE +.SH AUTHORS +tqdm developers . diff -Nru tqdm-4.23.4/tqdm/_tqdm_gui.py tqdm-4.28.1/tqdm/_tqdm_gui.py --- tqdm-4.23.4/tqdm/_tqdm_gui.py 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/tqdm/_tqdm_gui.py 2018-10-15 16:09:30.000000000 +0000 @@ -140,11 +140,9 @@ if delta_t >= mininterval: elapsed = cur_t - start_t # EMA (not just overall average) - if smoothing and delta_t: - avg_time = delta_t / delta_it \ - if avg_time is None \ - else smoothing * delta_t / delta_it + \ - (1 - smoothing) * avg_time + if smoothing and delta_t and delta_it: + rate = delta_t / delta_it + avg_time = self.ema(rate, avg_time, smoothing) # Inline due to multiple calls total = self.total @@ -208,11 +206,12 @@ elif mininterval and delta_t: # EMA-weight miniters to converge # towards the timeframe of mininterval - miniters = smoothing * delta_it * mininterval \ - / delta_t + (1 - smoothing) * miniters + rate = delta_it + if mininterval and delta_t: + rate *= mininterval / delta_t + miniters = self.ema(rate, miniters, smoothing) else: - miniters = smoothing * delta_it + \ - (1 - smoothing) * miniters + miniters = self.ema(delta_it, miniters, smoothing) # Store old values for next call last_print_n = n @@ -242,11 +241,9 @@ if delta_t >= self.mininterval: elapsed = cur_t - self.start_t # EMA (not just overall average) - if self.smoothing and delta_t: - self.avg_time = delta_t / delta_it \ - if self.avg_time is None \ - else self.smoothing * delta_t / delta_it + \ - (1 - self.smoothing) * self.avg_time + if self.smoothing and delta_t and delta_it: + rate = delta_t / delta_it + self.avg_time = self.ema(rate, self.avg_time, self.smoothing) # Inline due to multiple calls total = self.total diff -Nru tqdm-4.23.4/tqdm/_tqdm_notebook.py tqdm-4.28.1/tqdm/_tqdm_notebook.py --- tqdm-4.23.4/tqdm/_tqdm_notebook.py 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/tqdm/_tqdm_notebook.py 2018-10-15 16:09:30.000000000 +0000 @@ -19,9 +19,15 @@ if True: # pragma: no cover # import IPython/Jupyter base widget and display utilities + IPY = 0 + IPYW = 0 try: # IPython 4.x import ipywidgets IPY = 4 + try: + IPYW = int(ipywidgets.__version__.split('.')[0]) + except AttributeError: # __version__ may not exist in old versions + pass except ImportError: # IPython 3.x / 2.x IPY = 32 import warnings @@ -92,14 +98,24 @@ # fp = file # Prepare IPython progress bar - if total: - pbar = IntProgress(min=0, max=total) - else: # No total? Show info style bar with no progress tqdm status - pbar = IntProgress(min=0, max=1) - pbar.value = 1 - pbar.bar_style = 'info' + try: + if total: + pbar = IntProgress(min=0, max=total) + else: # No total? Show info style bar with no progress tqdm status + pbar = IntProgress(min=0, max=1) + pbar.value = 1 + pbar.bar_style = 'info' + except NameError: + # #187 #451 #558 + raise ImportError( + "IntProgress not found. Please update jupyter and ipywidgets." + " See https://ipywidgets.readthedocs.io/en/stable" + "/user_install.html") + if desc: pbar.description = desc + if IPYW >= 7: + pbar.style.description_width = 'initial' # Prepare status text ptext = HTML() # Only way to place text to the right of the bar is to use a container @@ -108,9 +124,11 @@ if ncols is not None: # use default style of ipywidgets # ncols could be 100, "100px", "100%" ncols = str(ncols) # ipywidgets only accepts string - if ncols[-1].isnumeric(): - # if last value is digit, assume the value is digit - ncols += 'px' + try: + if int(ncols) > 0: # isnumeric and positive + ncols += 'px' + except ValueError: + pass pbar.layout.flex = '2' container.layout.width = ncols container.layout.display = 'inline-flex' @@ -162,6 +180,8 @@ # Update description if desc: pbar.description = desc + if IPYW >= 7: + pbar.style.description_width = 'initial' return print_status diff -Nru tqdm-4.23.4/tqdm/_tqdm.py tqdm-4.28.1/tqdm/_tqdm.py --- tqdm-4.23.4/tqdm/_tqdm.py 2018-05-22 19:02:36.000000000 +0000 +++ tqdm-4.28.1/tqdm/_tqdm.py 2018-10-15 16:09:30.000000000 +0000 @@ -13,7 +13,7 @@ # compatibility functions and utilities from ._utils import _supports_unicode, _environ_cols_wrapper, _range, _unich, \ _term_move_up, _unicode, WeakSet, _basestring, _OrderedDict, \ - Comparable + Comparable, RE_ANSI from ._monitor import TMonitor # native libraries import sys @@ -141,7 +141,7 @@ Number with Order of Magnitude SI unit postfix. """ for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']: - if abs(num) < 999.95: + if abs(num) < 999.5: if abs(num) < 99.95: if abs(num) < 9.995: return '{0:1.2f}'.format(num) + unit + suffix @@ -159,6 +159,7 @@ ---------- t : int Number of seconds. + Returns ------- out : str @@ -172,6 +173,44 @@ return '{0:02d}:{1:02d}'.format(m, s) @staticmethod + def format_num(n): + """ + Intelligent scientific notation (.3g). + + Parameters + ---------- + n : int or float or Numeric + A Number. + + Returns + ------- + out : str + Formatted number. + """ + f = '{0:.3g}'.format(n).replace('+0', '+').replace('-0', '-') + n = str(n) + return f if len(f) < len(n) else n + + @staticmethod + def ema(x, mu=None, alpha=0.3): + """ + Exponential moving average: smoothing to give progressively lower + weights to older values. + + Parameters + ---------- + x : float + New value to include in EMA. + mu : float, optional + Previous EMA value. + alpha : float, optional + Smoothing factor in range [0, 1], [default: 0.3]. + Increase to give more weight to recent values. + Ranges from 0 (yields mu) to 1 (yields x). + """ + return x if mu is None else (alpha * x) + (1 - alpha) * mu + + @staticmethod def status_printer(file): """ Manage the printing and in-place updating of a line of characters. @@ -266,6 +305,8 @@ if unit_scale and unit_scale not in (True, 1): total *= unit_scale n *= unit_scale + if rate: + rate *= unit_scale # by default rate = 1 / self.avg_time unit_scale = False format_interval = tqdm.format_interval @@ -360,10 +401,11 @@ # Else no progress bar, we can just format and return return bar_format.format(**bar_args) - # Formatting progress bar - # space available for bar's display - N_BARS = max(1, ncols - len(l_bar) - len(r_bar)) if ncols \ - else 10 + # Formatting progress bar space available for bar's display + if ncols: + N_BARS = max(1, ncols - len(RE_ANSI.sub('', l_bar + r_bar))) + else: + N_BARS = 10 # format bar depending on availability of unicode/ascii chars if ascii: @@ -438,9 +480,11 @@ try: cls._instances.remove(instance) except KeyError: - if not instance.gui: # pragma: no cover - raise - else: + # if not instance.gui: # pragma: no cover + # raise + pass # py2: maybe magically removed already + # else: + if not instance.gui: for inst in cls._instances: # negative `pos` means fixed if inst.pos > abs(instance.pos): @@ -579,6 +623,10 @@ not isinstance(df, _Rolling_and_Expanding): # DataFrame or Panel axis = kwargs.get('axis', 0) + if axis == 'index': + axis = 0 + elif axis == 'columns': + axis = 1 # when axis=0, total is shape[axis1] total = df.size // df.shape[axis] @@ -673,9 +721,9 @@ fallback is a meter width of 10 and no limit for the counter and statistics. If 0, will not print any meter (only stats). mininterval : float, optional - Minimum progress display update interval, in seconds [default: 0.1]. + Minimum progress display update interval [default: 0.1] seconds. maxinterval : float, optional - Maximum progress display update interval, in seconds [default: 10]. + Maximum progress display update interval [default: 10] seconds. Automatically adjusts `miniters` to correspond to `mininterval` after long display update lag. Only works if `dynamic_miniters` or monitor thread is enabled. @@ -748,12 +796,19 @@ if disable is None and hasattr(file, "isatty") and not file.isatty(): disable = True + if total is None and iterable is not None: + try: + total = len(iterable) + except (TypeError, AttributeError): + total = None + if disable: self.iterable = iterable self.disable = disable self.pos = self._get_free_pos(self) self._instances.remove(self) self.n = initial + self.total = total return if kwargs: @@ -766,12 +821,6 @@ else TqdmKeyError("Unknown argument(s): " + str(kwargs))) # Preprocess the arguments - if total is None and iterable is not None: - try: - total = len(iterable) - except (TypeError, AttributeError): - total = None - if ((ncols is None) and (file in (sys.stderr, sys.stdout))) or \ dynamic_ncols: # pragma: no cover if dynamic_ncols: @@ -941,10 +990,9 @@ delta_it = n - last_print_n # EMA (not just overall average) if smoothing and delta_t and delta_it: - avg_time = delta_t / delta_it \ - if avg_time is None \ - else smoothing * delta_t / delta_it + \ - (1 - smoothing) * avg_time + rate = delta_t / delta_it + avg_time = self.ema(rate, avg_time, smoothing) + self.avg_time = avg_time self.n = n with self._lock: @@ -969,10 +1017,10 @@ elif smoothing: # EMA-weight miniters to converge # towards the timeframe of mininterval - miniters = smoothing * delta_it * \ - (mininterval / delta_t - if mininterval and delta_t else 1) + \ - (1 - smoothing) * miniters + rate = delta_it + if mininterval and delta_t: + rate *= mininterval / delta_t + miniters = self.ema(rate, miniters, smoothing) else: # Maximum nb of iterations between 2 prints miniters = max(miniters, delta_it) @@ -1026,10 +1074,8 @@ # elapsed = cur_t - self.start_t # EMA (not just overall average) if self.smoothing and delta_t and delta_it: - self.avg_time = delta_t / delta_it \ - if self.avg_time is None \ - else self.smoothing * delta_t / delta_it + \ - (1 - self.smoothing) * self.avg_time + rate = delta_t / delta_it + self.avg_time = self.ema(rate, self.avg_time, self.smoothing) if not hasattr(self, "sp"): raise TqdmDeprecationWarning("""\ @@ -1173,7 +1219,7 @@ for key in postfix.keys(): # Number: limit the length of the string if isinstance(postfix[key], Number): - postfix[key] = '{0:2.3g}'.format(postfix[key]) + postfix[key] = self.format_num(postfix[key]) # Else for any other type, try to get the string conversion elif not isinstance(postfix[key], _basestring): postfix[key] = str(postfix[key]) diff -Nru tqdm-4.23.4/tqdm/_utils.py tqdm-4.28.1/tqdm/_utils.py --- tqdm-4.23.4/tqdm/_utils.py 2018-05-22 19:02:36.000000000 +0000 +++ tqdm-4.28.1/tqdm/_utils.py 2018-10-15 16:03:45.000000000 +0000 @@ -1,11 +1,13 @@ import os import subprocess from platform import system as _curos +import re CUR_OS = _curos() IS_WIN = CUR_OS in ['Windows', 'cli'] IS_NIX = (not IS_WIN) and any( CUR_OS.startswith(i) for i in ['CYGWIN', 'MSYS', 'Linux', 'Darwin', 'SunOS', 'FreeBSD', 'NetBSD']) +RE_ANSI = re.compile(r"\x1b\[[;\d]*[A-Za-z]") # Py2/3 compat. Empty conditional to avoid coverage diff -Nru tqdm-4.23.4/tqdm/_version.py tqdm-4.28.1/tqdm/_version.py --- tqdm-4.23.4/tqdm/_version.py 2018-05-22 19:03:00.000000000 +0000 +++ tqdm-4.28.1/tqdm/_version.py 2018-10-21 18:47:29.000000000 +0000 @@ -5,7 +5,7 @@ __all__ = ["__version__"] # major, minor, patch, -extra -version_info = 4, 23, 4 +version_info = 4, 28, 1 # Nice string for the version __version__ = '.'.join(map(str, version_info)) diff -Nru tqdm-4.23.4/tqdm.1 tqdm-4.28.1/tqdm.1 --- tqdm-4.23.4/tqdm.1 2018-05-13 23:34:20.000000000 +0000 +++ tqdm-4.28.1/tqdm.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,230 +0,0 @@ -.\" Automatically generated by Pandoc 1.19.2.1 -.\" -.TH "TQDM" "1" "2015\-2018" "tqdm User Manuals" "" -.hy -.SH NAME -.PP -tqdm \- fast, extensible progress bar for Python and CLI -.SH SYNOPSIS -.PP -tqdm [\f[I]options\f[]] -.SH DESCRIPTION -.PP -See . -Can be used as a pipe: -.IP -.nf -\f[C] -$\ #\ count\ lines\ of\ code -$\ cat\ *.py\ |\ tqdm\ |\ wc\ \-l -327it\ [00:00,\ 981773.38it/s] -327 - -$\ #\ find\ all\ files -$\ find\ .\ \-name\ "*.py"\ |\ tqdm\ |\ wc\ \-l -432it\ [00:00,\ 833842.30it/s] -432 - -#\ ...\ and\ more\ info -$\ find\ .\ \-name\ \[aq]*.py\[aq]\ \-exec\ wc\ \-l\ \\{}\ \\;\ \\ -\ \ |\ tqdm\ \-\-total\ 432\ \-\-unit\ files\ \-\-desc\ counting\ \\ -\ \ |\ awk\ \[aq]{\ sum\ +=\ $1\ };\ END\ {\ print\ sum\ }\[aq] -counting:\ 100%|█████████|\ 432/432\ [00:00<00:00,\ 794361.83files/s] -131998 -\f[] -.fi -.SH OPTIONS -.TP -.B \-h, \-\-help -Print this help and exit -.RS -.RE -.TP -.B \-v, \-\-version -Print version and exit -.RS -.RE -.TP -.B \-\-desc=\f[I]desc\f[] -str, optional. -Prefix for the progressbar. -.RS -.RE -.TP -.B \-\-total=\f[I]total\f[] -int, optional. -The number of expected iterations. -If unspecified, len(iterable) is used if possible. -As a last resort, only basic progress statistics are displayed (no ETA, -no progressbar). -If \f[C]gui\f[] is True and this parameter needs subsequent updating, -specify an initial arbitrary large positive integer, e.g. -int(9e9). -.RS -.RE -.TP -.B \-\-leave=\f[I]leave\f[] -bool, optional. -If [default: True], keeps all traces of the progressbar upon termination -of iteration. -.RS -.RE -.TP -.B \-\-ncols=\f[I]ncols\f[] -int, optional. -The width of the entire output message. -If specified, dynamically resizes the progressbar to stay within this -bound. -If unspecified, attempts to use environment width. -The fallback is a meter width of 10 and no limit for the counter and -statistics. -If 0, will not print any meter (only stats). -.RS -.RE -.TP -.B \-\-mininterval=\f[I]mininterval\f[] -float, optional. -Minimum progress display update interval, in seconds [default: 0.1]. -.RS -.RE -.TP -.B \-\-maxinterval=\f[I]maxinterval\f[] -float, optional. -Maximum progress display update interval, in seconds [default: 10]. -Automatically adjusts \f[C]miniters\f[] to correspond to -\f[C]mininterval\f[] after long display update lag. -Only works if \f[C]dynamic_miniters\f[] or monitor thread is enabled. -.RS -.RE -.TP -.B \-\-miniters=\f[I]miniters\f[] -int, optional. -Minimum progress display update interval, in iterations. -If 0 and \f[C]dynamic_miniters\f[], will automatically adjust to equal -\f[C]mininterval\f[] (more CPU efficient, good for tight loops). -If > 0, will skip display of specified number of iterations. -Tweak this and \f[C]mininterval\f[] to get very efficient loops. -If your progress is erratic with both fast and slow iterations (network, -skipping items, etc) you should set miniters=1. -.RS -.RE -.TP -.B \-\-ascii=\f[I]ascii\f[] -bool, optional. -If unspecified or False, use unicode (smooth blocks) to fill the meter. -The fallback is to use ASCII characters \f[C]1\-9\ #\f[]. -.RS -.RE -.TP -.B \-\-disable=\f[I]disable\f[] -bool, optional. -Whether to disable the entire progressbar wrapper [default: False]. -If set to None, disable on non\-TTY. -.RS -.RE -.TP -.B \-\-unit=\f[I]unit\f[] -str, optional. -String that will be used to define the unit of each iteration [default: -it]. -.RS -.RE -.TP -.B \-\-unit_scale=\f[I]unit_scale\f[] -bool or int or float, optional. -If 1 or True, the number of iterations will be reduced/scaled -automatically and a metric prefix following the International System of -Units standard will be added (kilo, mega, etc.) [default: False]. -If any other non\-zero number, will scale \f[C]total\f[] and \f[C]n\f[]. -.RS -.RE -.TP -.B \-\-dynamic_ncols=\f[I]dynamic_ncols\f[] -bool, optional. -If set, constantly alters \f[C]ncols\f[] to the environment (allowing -for window resizes) [default: False]. -.RS -.RE -.TP -.B \-\-smoothing=\f[I]smoothing\f[] -float, optional. -Exponential moving average smoothing factor for speed estimates (ignored -in GUI mode). -Ranges from 0 (average speed) to 1 (current/instantaneous speed) -[default: 0.3]. -.RS -.RE -.TP -.B \-\-bar_format=\f[I]bar_format\f[] -str, optional. -Specify a custom bar string formatting. -May impact performance. -[default: \[aq]{l_bar}{bar}{r_bar}\[aq]], where l_bar=\[aq]{desc}: -{percentage:3.0f}%|\[aq] and r_bar=\[aq]| {n_fmt}/{total_fmt} -[{elapsed}<{remaining}, \[aq] \[aq]{rate_fmt}{postfix}]\[aq] Possible -vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, percentage, rate, -rate_fmt, rate_noinv, rate_noinv_fmt, rate_inv, rate_inv_fmt, elapsed, -remaining, desc, postfix. -Note that a trailing ": " is automatically removed after {desc} if the -latter is empty. -.RS -.RE -.TP -.B \-\-initial=\f[I]initial\f[] -int, optional. -The initial counter value. -Useful when restarting a progress bar [default: 0]. -.RS -.RE -.TP -.B \-\-position=\f[I]position\f[] -int, optional. -Specify the line offset to print this bar (starting from 0) Automatic if -unspecified. -Useful to manage multiple bars at once (eg, from threads). -.RS -.RE -.TP -.B \-\-postfix=\f[I]postfix\f[] -dict or *, optional. -Specify additional stats to display at the end of the bar. -Calls \f[C]set_postfix(**postfix)\f[] if possible (dict). -.RS -.RE -.TP -.B \-\-unit_divisor=\f[I]unit_divisor\f[] -float, optional. -[default: 1000], ignored unless \f[C]unit_scale\f[] is True. -.RS -.RE -.TP -.B \-\-delim=\f[I]delim\f[] -chr, optional. -Delimiting character [default: \[aq]\[aq]]. -Use \[aq]\[aq] for null. -N.B.: on Windows systems, Python converts \[aq]\[aq] to \[aq]\[aq]. -.RS -.RE -.TP -.B \-\-buf_size=\f[I]buf_size\f[] -int, optional. -String buffer size in bytes [default: 256] used when \f[C]delim\f[] is -specified. -.RS -.RE -.TP -.B \-\-bytes=\f[I]bytes\f[] -bool, optional. -If true, will count bytes, ignore \f[C]delim\f[], and default -\f[C]unit_scale\f[] to True, \f[C]unit_divisor\f[] to 1024, and -\f[C]unit\f[] to \[aq]B\[aq]. -.RS -.RE -.TP -.B \-\-log=\f[I]log\f[] -str, optional. -CRITICAL|FATAL|ERROR|WARN(ING)|[default: \[aq]INFO\[aq]]|DEBUG|NOTSET. -.RS -.RE -.SH AUTHORS -tqdm developers . diff -Nru tqdm-4.23.4/tqdm.egg-info/PKG-INFO tqdm-4.28.1/tqdm.egg-info/PKG-INFO --- tqdm-4.23.4/tqdm.egg-info/PKG-INFO 2018-05-22 19:06:50.000000000 +0000 +++ tqdm-4.28.1/tqdm.egg-info/PKG-INFO 2018-10-21 19:37:30.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: tqdm -Version: 4.23.4 +Version: 4.28.1 Summary: Fast, Extensible Progress Meter Home-page: https://github.com/tqdm/tqdm Author: Noam Yorav-Raphael @@ -21,7 +21,7 @@ ``tqdm`` means "progress" in Arabic (taqadum, تقدّم) - and an abbreviation for "I love you so much" in Spanish (te quiero demasiado). + and is an abbreviation for "I love you so much" in Spanish (te quiero demasiado). Instantly make your loops show a smart progress meter - just wrap any iterable with ``tqdm(iterable)``, and you're done! @@ -276,7 +276,7 @@ maxinterval=10.0, miniters=None, ascii=None, disable=False, unit='it', unit_scale=False, dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, position=None, - postfix=None): + postfix=None, unit_divisor=1000): Parameters ~~~~~~~~~~ @@ -287,7 +287,7 @@ * desc : str, optional Prefix for the progressbar. * total : int, optional - The number of expected iterations. If (default: None), + The number of expected iterations. If unspecified, len(iterable) is used if possible. As a last resort, only basic progress statistics are displayed (no ETA, no progressbar). If ``gui`` is True and this parameter needs subsequent updating, @@ -307,9 +307,9 @@ fallback is a meter width of 10 and no limit for the counter and statistics. If 0, will not print any meter (only stats). * mininterval : float, optional - Minimum progress display update interval, in seconds [default: 0.1]. + Minimum progress display update interval [default: 0.1] seconds. * maxinterval : float, optional - Maximum progress display update interval, in seconds [default: 10]. + Maximum progress display update interval [default: 10] seconds. Automatically adjusts ``miniters`` to correspond to ``mininterval`` after long display update lag. Only works if ``dynamic_miniters`` or monitor thread is enabled. @@ -326,7 +326,7 @@ the meter. The fallback is to use ASCII characters ``1-9 #``. * disable : bool, optional Whether to disable the entire progressbar wrapper - [default: False]. + [default: False]. If set to None, disable on non-TTY. * unit : str, optional String that will be used to define the unit of each iteration [default: it]. @@ -675,6 +675,19 @@ |Screenshot-Jupyter2| |Screenshot-Jupyter3| + It is also possible to let ``tqdm`` automatically choose between + console or notebook versions by using the ``autonotebook`` submodule: + + .. code:: python + + from tqdm.autonotebook import tqdm + tqdm.pandas() + + Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook + since it is not meant to be possible to distinguish between ``jupyter notebook`` + and ``jupyter console``. Use ``auto`` instead of ``autonotebook`` to suppress + this warning. + Writing messages ~~~~~~~~~~~~~~~~ @@ -808,6 +821,12 @@ `CONTRIBUTING `__ file for more information. + Ports to Other Languages + ~~~~~~~~~~~~~~~~~~~~~~~~ + + A list is available on + `this wiki page `__. + LICENCE ------- @@ -820,12 +839,13 @@ Authors ------- - The main developers, ranked by surviving lines of code, are: + The main developers, ranked by surviving lines of code + (`git fame -wMC `__), are: - Casper da Costa-Luis (`casperdcl `__, ~2/3, |Gift-Casper|) - - Stephen Larroque (`lrq3000 `__, ~1/3) + - Stephen Larroque (`lrq3000 `__, ~1/5) + - Hadrien Mary (`hadim `__, ~2%) - Guangshuo Chen (`chengs `__, ~1%) - - Hadrien Mary (`hadim `__, ~1%) - Noam Yorav-Raphael (`noamraph `__, ~1%, original author) - Mikhail Korobov (`kmike `__, ~1%) @@ -860,11 +880,11 @@ .. |Gift-Casper| image:: https://img.shields.io/badge/gift-donate-ff69b4.svg :target: https://caspersci.uk.to/donate.html .. |PyPI-Status| image:: https://img.shields.io/pypi/v/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg - :target: https://pypi.python.org/pypi/tqdm + :target: https://pypi.org/project/tqdm .. |Conda-Forge-Status| image:: https://anaconda.org/conda-forge/tqdm/badges/version.svg :target: https://anaconda.org/conda-forge/tqdm .. |OpenHub-Status| image:: https://www.openhub.net/p/tqdm/widgets/project_thin_badge?format=gif diff -Nru tqdm-4.23.4/tqdm.egg-info/SOURCES.txt tqdm-4.28.1/tqdm.egg-info/SOURCES.txt --- tqdm-4.23.4/tqdm.egg-info/SOURCES.txt 2018-05-22 19:06:50.000000000 +0000 +++ tqdm-4.28.1/tqdm.egg-info/SOURCES.txt 2018-10-21 19:37:30.000000000 +0000 @@ -8,7 +8,6 @@ setup.cfg setup.py tox.ini -tqdm.1 examples/7zx.py examples/include_no_requirements.py examples/pandas_progress_apply.py @@ -30,11 +29,14 @@ tqdm/_tqdm_pandas.py tqdm/_utils.py tqdm/_version.py +tqdm/tqdm.1 tqdm.egg-info/PKG-INFO tqdm.egg-info/SOURCES.txt tqdm.egg-info/dependency_links.txt tqdm.egg-info/entry_points.txt tqdm.egg-info/top_level.txt +tqdm/auto/__init__.py +tqdm/autonotebook/__init__.py tqdm/tests/tests_main.py tqdm/tests/tests_pandas.py tqdm/tests/tests_perf.py