8

I want use progress bars in my python code. I know there are many libraries for that but I want to use the progress bars used by pip [the package manager]. Please tell if there is a way to do this.

ty.py
  • 169
  • 1
  • 7
  • [Souce code of pip](https://github.com/pypa/pip). It's probably in _vendor/progress and it's used in _internal/cli – Wups Oct 27 '20 at 08:27
  • The answers below are outdated. Pip now has a nicer progress bar with color. more info here: https://stackoverflow.com/questions/71923704/new-color-terminal-prograss-bar-in-pip – J'e Nov 16 '22 at 19:07

3 Answers3

8

The progress package available on pypi is used by pip. It can be imported by including the following line in your python file:

from pip._vendor import progress

Usage is available on https://pypi.org/project/progress/

ty.py
  • 169
  • 1
  • 7
5

Look under rich progress bar :)

baggiponte
  • 547
  • 6
  • 13
4

Here, you can use tqdm. And you can customize it to any extent.

https://pypi.org/project/tqdm/

  • but it needs to be installed which I don't want to – ty.py Oct 27 '20 at 08:24
  • pip uses it's own progress bar (their own source code), check their codebase: https://github.com/pypa/pip/blob/master/src/pip/_vendor/progress/bar.py – Rohit Kewalramani Oct 27 '20 at 08:29
  • is there a way to import and use its progress bars – ty.py Oct 27 '20 at 08:33
  • Yes (would be quite complex though), depends on how you plan to use it. Take the inspiration from the following codebase https://github.com/pypa/pip/blob/master/src/pip/_internal/cli/progress_bars.py. This will be an uphill task. – Rohit Kewalramani Oct 27 '20 at 08:39
  • I found that pip internally uses [progress](https://pypi.org/project/progress/) for its progress bars. They have copied the whole package inside the [_vendor](https://github.com/pypa/pip/tree/master/src/pip/_vendor). And there are many more there. – ty.py Oct 27 '20 at 09:59