Commit becc3847 authored by Mark Hymers's avatar Mark Hymers
Browse files

New upstream version 3.42.0

parents
=========
Changelog
=========
For the most recent changes to the Python Progressbar please look at the Git
releases or the commit log:
- https://github.com/WoLpH/python-progressbar/releases
- https://github.com/WoLpH/python-progressbar/commits/develop
Hint: click on the `...` button to see the change message.
============
Contributing
============
Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions
----------------------
Report Bugs
~~~~~~~~~~~
Report bugs at https://github.com/WoLpH/python-progressbar/issues.
If you are reporting a bug, please include:
* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.
Fix Bugs
~~~~~~~~
Look through the GitHub issues for bugs. Anything tagged with "bug"
is open to whoever wants to implement it.
Implement Features
~~~~~~~~~~~~~~~~~~
Look through the GitHub issues for features. Anything tagged with "feature"
is open to whoever wants to implement it.
Write Documentation
~~~~~~~~~~~~~~~~~~~
Python Progressbar could always use more documentation, whether as part of the
official Python Progressbar docs, in docstrings, or even on the web in blog posts,
articles, and such.
Submit Feedback
~~~~~~~~~~~~~~~
The best way to send feedback is to file an issue at https://github.com/WoLpH/python-progressbar/issues.
If you are proposing a feature:
* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)
Get Started!
------------
Ready to contribute? Here's how to set up `python-progressbar` for local development.
1. Fork the `python-progressbar` repo on GitHub.
2. Clone your fork locally::
$ git clone --branch develop git@github.com:your_name_here/python-progressbar.git
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
$ mkvirtualenv progressbar
$ cd progressbar/
$ pip install -e .
4. Create a branch for local development with `git-flow-avh`_::
$ git-flow feature start name-of-your-bugfix-or-feature
Or without git-flow:
$ git checkout -b feature/name-of-your-bugfix-or-feature
Now you can make your changes locally.
5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
$ flake8 progressbar tests
$ py.test
$ tox
To get flake8 and tox, just pip install them into your virtualenv using the requirements file.
$ pip install -r tests/requirements.txt
6. Commit your changes and push your branch to GitHub with `git-flow-avh`_::
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git-flow feature publish
Or without git-flow:
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push -u origin feature/name-of-your-bugfix-or-feature
7. Submit a pull request through the GitHub website.
Pull Request Guidelines
-----------------------
Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7, 3.3, and for PyPy. Check
https://travis-ci.org/WoLpH/python-progressbar/pull_requests
and make sure that the tests pass for all supported Python versions.
Tips
----
To run a subset of tests::
$ py.test tests/some_test.py
.. _git-flow-avh: https://github.com/petervanderdoes/gitflow
Copyright (c) 2015, Rick van Hattem (Wolph)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Python Progressbar nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include AUTHORS.rst
include CHANGES.rst
include CONTRIBUTING.rst
include LICENSE
include README.rst
include examples.py
include requirements.txt
include Makefile
include pytest.ini
recursive-include tests *
.PHONY: clean-pyc clean-build docs
help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "lint - check style with flake8"
@echo "test - run tests quickly with the default Python"
@echo "testall - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "release - package and upload a release"
@echo "sdist - package"
clean: clean-build clean-pyc
clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
lint:
flake8 progressbar tests
test:
py.test
test-all:
tox
coverage:
coverage run --source progressbar setup.py test
coverage report -m
coverage html
open htmlcov/index.html
docs:
rm -f docs/progressbar.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ progressbar
$(MAKE) -C docs clean
$(MAKE) -C docs html
open docs/_build/html/index.html
release: clean
python setup.py register || true
python setup.py sdist upload build_sphinx upload_sphinx
sdist: clean
python setup.py sdist
ls -l dist
Metadata-Version: 2.1
Name: progressbar2
Version: 3.42.0
Summary: A Python Progressbar library to provide visual (yet text based) progress to long running operations.
Home-page: https://github.com/WoLpH/python-progressbar
Author: Rick van Hattem (Wolph)
Author-email: wolph@wol.ph
License: BSD
Description: ##############################################################################
Text progress bar library for Python.
##############################################################################
Travis status:
.. image:: https://travis-ci.org/WoLpH/python-progressbar.svg?branch=master
:target: https://travis-ci.org/WoLpH/python-progressbar
Coverage:
.. image:: https://coveralls.io/repos/WoLpH/python-progressbar/badge.svg?branch=master
:target: https://coveralls.io/r/WoLpH/python-progressbar?branch=master
******************************************************************************
Install
******************************************************************************
The package can be installed through `pip` (this is the recommended method):
pip install progressbar2
Or if `pip` is not available, `easy_install` should work as well:
easy_install progressbar2
Or download the latest release from Pypi (https://pypi.python.org/pypi/progressbar2) or Github.
Note that the releases on Pypi are signed with my GPG key (https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE81444E9CE1F695D) and can be checked using GPG:
gpg --verify progressbar2-<version>.tar.gz.asc progressbar2-<version>.tar.gz
******************************************************************************
Introduction
******************************************************************************
A text progress bar is typically used to display the progress of a long
running operation, providing a visual cue that processing is underway.
The ProgressBar class manages the current progress, and the format of the line
is given by a number of widgets. A widget is an object that may display
differently depending on the state of the progress bar. There are many types
of widgets:
- `AbsoluteETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AbsoluteETA>`_
- `AdaptiveETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AdaptiveETA>`_
- `AdaptiveTransferSpeed <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AdaptiveTransferSpeed>`_
- `AnimatedMarker <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AnimatedMarker>`_
- `Bar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Bar>`_
- `BouncingBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#BouncingBar>`_
- `Counter <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Counter>`_
- `CurrentTime <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#CurrentTime>`_
- `DataSize <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#DataSize>`_
- `DynamicMessage <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#DynamicMessage>`_
- `ETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#ETA>`_
- `FileTransferSpeed <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FileTransferSpeed>`_
- `FormatCustomText <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FormatCustomText>`_
- `FormatLabel <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FormatLabel>`_
- `Percentage <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Percentage>`_
- `ReverseBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#ReverseBar>`_
- `RotatingMarker <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#RotatingMarker>`_
- `SimpleProgress <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#SimpleProgress>`_
- `Timer <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Timer>`_
The progressbar module is very easy to use, yet very powerful. It will also
automatically enable features like auto-resizing when the system supports it.
******************************************************************************
Known issues
******************************************************************************
Due to limitations in both the IDLE shell and the Jetbrains (Pycharm) shells this progressbar cannot function properly within those.
- The IDLE editor doesn't support these types of progress bars at all: https://bugs.python.org/issue23220
- The Jetbrains (Pycharm) editors partially work but break with fast output. As a workaround make sure you only write to either `sys.stdout` (regular print) or `sys.stderr` at the same time. If you do plan to use both, make sure you wait about ~200 milliseconds for the next output or it will break regularly. Linked issue: https://github.com/WoLpH/python-progressbar/issues/115
- Jupyter notebooks buffer `sys.stdout` which can cause mixed output. This issue can be resolved easily using: `import sys; sys.stdout.flush()`. Linked issue: https://github.com/WoLpH/python-progressbar/issues/173
******************************************************************************
Links
******************************************************************************
* Documentation
- https://progressbar-2.readthedocs.org/en/latest/
* Source
- https://github.com/WoLpH/python-progressbar
* Bug reports
- https://github.com/WoLpH/python-progressbar/issues
* Package homepage
- https://pypi.python.org/pypi/progressbar2
* My blog
- https://w.wol.ph/
******************************************************************************
Usage
******************************************************************************
There are many ways to use Python Progressbar, you can see a few basic examples
here but there are many more in the examples file.
Wrapping an iterable
==============================================================================
.. code:: python
import time
import progressbar
for i in progressbar.progressbar(range(100)):
time.sleep(0.02)
Progressbars with logging
==============================================================================
Progressbars with logging require `stderr` redirection _before_ the
`StreamHandler` is initialized. To make sure the `stderr` stream has been
redirected on time make sure to call `progressbar.streams.wrap_stderr()` before
you initialize the `logger`.
One option to force early initialization is by using the `WRAP_STDERR`
environment variable, on Linux/Unix systems this can be done through:
.. code:: sh
# WRAP_STDERR=true python your_script.py
If you need to flush manually while wrapping, you can do so using:
.. code:: python
import progressbar
progressbar.streams.flush()
In most cases the following will work as well, as long as you initialize the
`StreamHandler` after the wrapping has taken place.
.. code:: python
import time
import logging
import progressbar
progressbar.streams.wrap_stderr()
logging.basicConfig()
for i in progressbar.progressbar(range(10)):
logging.error('Got %d', i)
time.sleep(0.2)
Context wrapper
==============================================================================
.. code:: python
import time
import progressbar
with progressbar.ProgressBar(max_value=10) as bar:
for i in range(10):
time.sleep(0.1)
bar.update(i)
Combining progressbars with print output
==============================================================================
.. code:: python
import time
import progressbar
for i in progressbar.progressbar(range(100), redirect_stdout=True):
print('Some text', i)
time.sleep(0.1)
Progressbar with unknown length
==============================================================================
.. code:: python
import time
import progressbar
bar = progressbar.ProgressBar(max_value=progressbar.UnknownLength)
for i in range(20):
time.sleep(0.1)
bar.update(i)
Bar with custom widgets
==============================================================================
.. code:: python
import time
import progressbar
widgets=[
' [', progressbar.Timer(), '] ',
progressbar.Bar(),
' (', progressbar.ETA(), ') ',
]
for i in progressbar.progressbar(range(20), widgets=widgets):
time.sleep(0.1)
Bar with wide Chinese (or other multibyte) characters
==============================================================================
.. code:: python
# vim: fileencoding=utf-8
import time
import progressbar
def custom_len(value):
# These characters take up more space
characters = {
'进': 2,
'度': 2,
}
total = 0
for c in value:
total += characters.get(c, 1)
return total
bar = progressbar.ProgressBar(
widgets=[
'进度: ',
progressbar.Bar(),
' ',
progressbar.Counter(format='%(value)02d/%(max_value)d'),
],
len_func=custom_len,
)
for i in bar(range(10)):
time.sleep(0.1)
Keywords: Python Progressbar
Platform: UNKNOWN
Classifier: Development Status :: 6 - Mature
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: PyPy
Provides-Extra: docs
Provides-Extra: tests
##############################################################################
Text progress bar library for Python.
##############################################################################
Travis status:
.. image:: https://travis-ci.org/WoLpH/python-progressbar.svg?branch=master
:target: https://travis-ci.org/WoLpH/python-progressbar
Coverage:
.. image:: https://coveralls.io/repos/WoLpH/python-progressbar/badge.svg?branch=master
:target: https://coveralls.io/r/WoLpH/python-progressbar?branch=master
******************************************************************************
Install
******************************************************************************
The package can be installed through `pip` (this is the recommended method):
pip install progressbar2
Or if `pip` is not available, `easy_install` should work as well:
easy_install progressbar2
Or download the latest release from Pypi (https://pypi.python.org/pypi/progressbar2) or Github.
Note that the releases on Pypi are signed with my GPG key (https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE81444E9CE1F695D) and can be checked using GPG:
gpg --verify progressbar2-<version>.tar.gz.asc progressbar2-<version>.tar.gz
******************************************************************************
Introduction
******************************************************************************
A text progress bar is typically used to display the progress of a long
running operation, providing a visual cue that processing is underway.
The ProgressBar class manages the current progress, and the format of the line
is given by a number of widgets. A widget is an object that may display
differently depending on the state of the progress bar. There are many types
of widgets:
- `AbsoluteETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AbsoluteETA>`_
- `AdaptiveETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AdaptiveETA>`_
- `AdaptiveTransferSpeed <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AdaptiveTransferSpeed>`_
- `AnimatedMarker <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#AnimatedMarker>`_
- `Bar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Bar>`_
- `BouncingBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#BouncingBar>`_
- `Counter <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Counter>`_
- `CurrentTime <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#CurrentTime>`_
- `DataSize <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#DataSize>`_
- `DynamicMessage <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#DynamicMessage>`_
- `ETA <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#ETA>`_
- `FileTransferSpeed <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FileTransferSpeed>`_
- `FormatCustomText <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FormatCustomText>`_
- `FormatLabel <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#FormatLabel>`_
- `Percentage <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Percentage>`_
- `ReverseBar <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#ReverseBar>`_
- `RotatingMarker <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#RotatingMarker>`_
- `SimpleProgress <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#SimpleProgress>`_
- `Timer <http://progressbar-2.readthedocs.io/en/latest/_modules/progressbar/widgets.html#Timer>`_
The progressbar module is very easy to use, yet very powerful. It will also
automatically enable features like auto-resizing when the system supports it.
******************************************************************************
Known issues
******************************************************************************
Due to limitations in both the IDLE shell and the Jetbrains (Pycharm) shells this progressbar cannot function properly within those.
- The IDLE editor doesn't support these types of progress bars at all: https://bugs.python.org/issue23220
- The Jetbrains (Pycharm) editors partially work but break with fast output. As a workaround make sure you only write to either `sys.stdout` (regular print) or `sys.stderr` at the same time. If you do plan to use both, make sure you wait about ~200 milliseconds for the next output or it will break regularly. Linked issue: https://github.com/WoLpH/python-progressbar/issues/115
- Jupyter notebooks buffer `sys.stdout` which can cause mixed output. This issue can be resolved easily using: `import sys; sys.stdout.flush()`. Linked issue: https://github.com/WoLpH/python-progressbar/issues/173
******************************************************************************
Links
******************************************************************************
* Documentation
- https://progressbar-2.readthedocs.org/en/latest/
* Source
- https://github.com/WoLpH/python-progressbar
* Bug reports
- https://github.com/WoLpH/python-progressbar/issues
* Package homepage
- https://pypi.python.org/pypi/progressbar2
* My blog
- https://w.wol.ph/
******************************************************************************
Usage
******************************************************************************
There are many ways to use Python Progressbar, you can see a few basic examples
here but there are many more in the examples file.
Wrapping an iterable
==============================================================================
.. code:: python
import time
import progressbar
for i in progressbar.progressbar(range(100)):
time.sleep(0.02)
Progressbars with logging
==============================================================================
Progressbars with logging require `stderr` redirection _before_ the
`StreamHandler` is initialized. To make sure the `stderr` stream has been
redirected on time make sure to call `progressbar.streams.wrap_stderr()` before
you initialize the `logger`.
One option to force early initialization is by using the `WRAP_STDERR`
environment variable, on Linux/Unix systems this can be done through:
.. code:: sh
# WRAP_STDERR=true python your_script.py
If you need to flush manually while wrapping, you can do so using:
.. code:: python
import progressbar
progressbar.streams.flush()
In most cases the following will work as well, as long as you initialize the
`StreamHandler` after the wrapping has taken place.
.. code:: python
import time
import logging
import progressbar
progressbar.streams.wrap_stderr()
logging.basicConfig()
for i in progressbar.progressbar(range(10)):
logging.error('Got %d', i)
time.sleep(0.2)
Context wrapper
==============================================================================
.. code:: python
import time
import progressbar
with progressbar.ProgressBar(max_value=10) as bar:
for i in range(10):
time.sleep(0.1)
bar.update(i)