tqdm/README.md

78 lines
2.3 KiB
Markdown
Raw Normal View History

2015-06-06 14:12:49 +00:00
![Logo](logo.png)
# tqdm
2013-10-26 18:50:04 +00:00
[![Build Status](https://travis-ci.org/tqdm/tqdm.svg?branch=master)](https://travis-ci.org/tqdm/tqdm)
[![Coverage Status](https://coveralls.io/repos/tqdm/tqdm/badge.svg)](https://coveralls.io/r/tqdm/tqdm)
Instantly make your loops show a progress meter - just wrap any iterable with
"tqdm(iterable)", and you're done!
2014-01-10 08:06:45 +00:00
tqdm (read ta<i>qa</i>dum, تقدّم) means "progress" in arabic.
2013-10-26 19:31:27 +00:00
2015-06-06 14:12:49 +00:00
![Screenshot](tqdm.gif)
2013-10-26 19:31:27 +00:00
You can also use trange(N) as a shortcut for tqdm(xrange(N))
## Installation
```sh
pip install tqdm
# or
pip install -e git+https://github.com/tqdm/tqdm.git#egg=master
```
## Documentation
2014-01-10 08:06:45 +00:00
```python
def tqdm(iterable, desc='', total=None,
leave=False, file=sys.stderr,
mininterval=0.5, miniters=1):
2015-06-07 22:19:28 +00:00
"""Get an iterable object, and return an iterator which acts exactly like
the iterable, but prints a progress meter and updates it every time a
value is requested.
Parameters
----------
iterable: iterable
Iterable to show progress for.
desc: str, optional
2015-06-07 22:19:28 +00:00
A short string, describing the progress, that is added in the beginning
of the line.
total : int, optional
2015-06-07 22:19:28 +00:00
The number of expected iterations. If not given, len(iterable) is used
if it is defined.
file : `io.TextIOWrapper` or `io.StringIO`, optional
A file-like object to output the progress message to. By default,
sys.stderr is used.
leave : bool, optional
If it is False (default), tqdm deletes its traces from screen after
it has finished iterating over all elements.
mininterval : float, optional
If less than mininterval seconds have passed since the last progress
meter update, it is not updated again (default: 0.5).
miniters : float, optional
If less than miniters iterations have passed since the last progress
meter update, it is not updated again (default: 1).
2014-01-10 08:06:45 +00:00
"""
def trange(*args, **kwargs):
"""A shortcut for writing tqdm(xrange)"""
return tqdm(xrange(*args), **kwargs)
```
2014-02-05 08:19:33 +00:00
## Contributions
To run the testing suite please make sure tox (http://tox.testrun.org/)
is installed, then type `tox` from the command line.
## License
[MIT LICENSE](LICENSE).
## Authors
2014-02-05 08:19:33 +00:00
- noamraph (original author)