# What is this?
I wanted a light, clean, configurable alternative to tqdm. So I made one, complete with animations.
<img width="1724" alt="Screen Shot 2022-07-03 at 8 30 01 PM" src="https://user-images.githubusercontent.com/17692058/177068705-9efc56d3-4300-4982-a07a-6db9aa61df8d.png">
# How do I use this?
`pip install informative_iterator`
```python
from informative_iterator import ProgressBar
import time
#
# example 1
#
for progress, each_element in ProgressBar([ 1, 2, 3, "any iterable thing" ]):
time.sleep(0.002)
# example output:
# [>..................................] 0.00% | 0/1000 | started: 13:18:32 | eta: ________ | remaining: ________ |
# example output:
# [==============>....................] 42.50% | 425/1000 | started: 13:18:32 | eta: 13:18:44 | remaining: 0:07sec |
# example output:
# [================================>..] 93.10% | 931/1000 | started: 13:18:32 | eta: 13:18:44 | remaining: 0:01sec |
# example output:
# Done in 0:12sec at 13:18:44
#
# example 2
#
import random
def custom_iterable():
while True:
yield random.random()
for progress, each in ProgressBar(custom_iterable(), iterations=10000):
time.sleep(0.002)
#
# example 3
#
for progress, each in ProgressBar(10000):
time.sleep(0.002)
# index, just like using enumerate()
print('progress.index = ', progress.index)
# percent with two decimal places. ex: 99.5
print('progress.percent = ', progress.percent)
# the output of time.time() for this iteration (seconds since unix epoch)
print('progress.time = ', progress.time)
# boolean (updates dont always get printed every iteration)
print('progress.updated = ', progress.updated)
# int, doesn't change with each iteration: its the size of the iterator
print('progress.total_iterations = ', progress.total_iterations)
#
# example 4
#
# update ~30 times a second for smooth looking progress
for progress, each in ProgressBar(10000, seconds_per_print=0.03):
time.sleep(0.002)
#
# example 5
#
# have all progress bars default to trying to update update ~30 times a second
ProgressBar.configure(
seconds_per_print=0.03,
)
for progress, each in ProgressBar(10000):
time.sleep(0.002)
#
# example 6
#
ProgressBar.configure(
# all the options (these exist as arguments for ProgressBar as well)
layout=[ 'title', 'bar', 'percent', 'spacer', 'fraction', 'spacer', 'start_time', 'spacer', 'end_time', 'spacer', 'remaining_time', 'spacer', ],
spacer=" | ",
minmal=False, # False => defaults to normal layout
minimal_layout=[ 'title', 'bar', 'spacer', 'end_time', 'spacer', ],
inline=True,
disable_logging=False, # turn off all the output
progress_bar_size=35, # 35 characters
seconds_per_print=1, # print every second
percent_per_print=10, # And print every 10% of progress
)
for progress, each in ProgressBar(10000):
time.sleep(0.002)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/jeff-hykin/informative-iterator.git",
"name": "informative-iterator",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Jeff Hykin",
"author_email": "jeff.hykin@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ab/46/7d8624ff6a41dcd3d437c0531db4becef27b22fc5c72258ddd6df3f84465/informative_iterator-2.2.3.tar.gz",
"platform": null,
"description": "# What is this?\n\nI wanted a light, clean, configurable alternative to tqdm. So I made one, complete with animations.\n\n<img width=\"1724\" alt=\"Screen Shot 2022-07-03 at 8 30 01 PM\" src=\"https://user-images.githubusercontent.com/17692058/177068705-9efc56d3-4300-4982-a07a-6db9aa61df8d.png\">\n\n\n# How do I use this?\n\n`pip install informative_iterator`\n\n```python\nfrom informative_iterator import ProgressBar\nimport time\n\n# \n# example 1\n# \nfor progress, each_element in ProgressBar([ 1, 2, 3, \"any iterable thing\" ]):\n time.sleep(0.002)\n# example output:\n# [>..................................] 0.00% | 0/1000 | started: 13:18:32 | eta: ________ | remaining: ________ | \n# example output:\n# [==============>....................] 42.50% | 425/1000 | started: 13:18:32 | eta: 13:18:44 | remaining: 0:07sec | \n# example output:\n# [================================>..] 93.10% | 931/1000 | started: 13:18:32 | eta: 13:18:44 | remaining: 0:01sec | \n# example output:\n# Done in 0:12sec at 13:18:44\n\n# \n# example 2\n# \nimport random\ndef custom_iterable():\n while True:\n yield random.random()\n\nfor progress, each in ProgressBar(custom_iterable(), iterations=10000):\n time.sleep(0.002)\n\n# \n# example 3\n# \nfor progress, each in ProgressBar(10000):\n time.sleep(0.002)\n # index, just like using enumerate()\n print('progress.index = ', progress.index)\n # percent with two decimal places. ex: 99.5\n print('progress.percent = ', progress.percent)\n # the output of time.time() for this iteration (seconds since unix epoch)\n print('progress.time = ', progress.time)\n # boolean (updates dont always get printed every iteration)\n print('progress.updated = ', progress.updated)\n # int, doesn't change with each iteration: its the size of the iterator\n print('progress.total_iterations = ', progress.total_iterations)\n\n# \n# example 4\n# \n# update ~30 times a second for smooth looking progress\nfor progress, each in ProgressBar(10000, seconds_per_print=0.03):\n time.sleep(0.002)\n\n# \n# example 5\n# \n# have all progress bars default to trying to update update ~30 times a second\nProgressBar.configure(\n seconds_per_print=0.03,\n)\nfor progress, each in ProgressBar(10000):\n time.sleep(0.002)\n\n# \n# example 6\n# \nProgressBar.configure(\n # all the options (these exist as arguments for ProgressBar as well)\n layout=[ 'title', 'bar', 'percent', 'spacer', 'fraction', 'spacer', 'start_time', 'spacer', 'end_time', 'spacer', 'remaining_time', 'spacer', ],\n spacer=\" | \",\n minmal=False, # False => defaults to normal layout\n minimal_layout=[ 'title', 'bar', 'spacer', 'end_time', 'spacer', ],\n inline=True,\n disable_logging=False, # turn off all the output\n progress_bar_size=35, # 35 characters\n seconds_per_print=1, # print every second\n percent_per_print=10, # And print every 10% of progress\n)\nfor progress, each in ProgressBar(10000):\n time.sleep(0.002)\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A replacement for tqdm",
"version": "2.2.3",
"project_urls": {
"Homepage": "https://github.com/jeff-hykin/informative-iterator.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a3f103ce6ec5554b37a286529b28177788b8f25bfbb63cb02134e20261c28da7",
"md5": "ec54c8c4664d64ee48519e74a7547046",
"sha256": "52154973f6b8199beffcbcdf51ee217997abf99a3684bb06798aa7cf4c56f058"
},
"downloads": -1,
"filename": "informative_iterator-2.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ec54c8c4664d64ee48519e74a7547046",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 2206917,
"upload_time": "2023-10-20T16:15:36",
"upload_time_iso_8601": "2023-10-20T16:15:36.107047Z",
"url": "https://files.pythonhosted.org/packages/a3/f1/03ce6ec5554b37a286529b28177788b8f25bfbb63cb02134e20261c28da7/informative_iterator-2.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ab467d8624ff6a41dcd3d437c0531db4becef27b22fc5c72258ddd6df3f84465",
"md5": "714e964352a8f95a0a240b2150e998ca",
"sha256": "1d506b85dc43361bb360ec38de1c142a4f775758508631f85a0353cfe6aa3696"
},
"downloads": -1,
"filename": "informative_iterator-2.2.3.tar.gz",
"has_sig": false,
"md5_digest": "714e964352a8f95a0a240b2150e998ca",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 2105501,
"upload_time": "2023-10-20T16:15:45",
"upload_time_iso_8601": "2023-10-20T16:15:45.624079Z",
"url": "https://files.pythonhosted.org/packages/ab/46/7d8624ff6a41dcd3d437c0531db4becef27b22fc5c72258ddd6df3f84465/informative_iterator-2.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-20 16:15:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jeff-hykin",
"github_project": "informative-iterator",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "informative-iterator"
}