Skip to main content

lowbar

The simplest no-nonsense progress bar for python




Introduction

lowbar is a blazing fast module with zero dependencies for displaying a progress bar in the terminal. It has a low number of features and a simple codebase, hence the name lowbar.



Installation

Install the latest stable release:

pip install lowbar

Or the development version (Undocumented):

pip install git+https://github.com/AnnikaV9/lowbar


Usage

Once you have lowbar installed, you can import it like any other module:

import lowbar

And initialize the bar:

bar = lowbar.LowBar()

To make the bar visible and set at 0%:

bar.new()

After completing some tasks, we can increase the bar's completion percentage:

bar.update(20)

The above function will immediately move the bar to 20%. To use a more smoother but slower animation:

bar.update_smooth(40)

Note: Since version 1.1.4, update_smooth() is no-longer fully blocking. It will run in a separate thread, so your program will continue it's execution while the bar is animating. However, calling another lowbar function during the animation will block the main thread to prevent visual glitches. To avoid this block, make sure to call log() before update_smooth(), not after. See issue #5


Using print() or other similar functions will push the bar up, which doesn't look nice. To log messages without affecting the bar:

bar.log("Hello World!")

And finally, to clear the bar completely:

bar.clear()

Here's an example usage of the bar:

bar = lowbar.LowBar()

completion = 0
bar.new()
for i in range(10):
    time.sleep(2) # This would be replaced with an actual task
    bar.log(f"Task {i+1} completed")
    completion += 10
    bar.update_smooth(completion)
bar.clear()

print("Tasks complete!")

You don't even need a loop:

bar = lowbar.LowBar()

bar.new()
time.sleep(1)
bar.update_smooth(10)
time.sleep(2)
bar.update_smooth(40)
time.sleep(2)
bar.update_smooth(100)
bar.clear()

print("Tasks complete!")

The bar can also be used with a context manager. It will automatically run new() at the start and clear() when exiting:

with lowbar.LowBar() as bar:
    time.sleep(1)
    bar.update_smooth(10)
    time.sleep(3)
    bar.update_smooth(100)

print("Tasks complete!")

To make things even more simpler, you can wrap lowbar around an interable. It will automatically calculate how much to increase the percentage by every loop:

for i in lowbar.LowBar(range(100)):
    time.sleep(0.5)

lowbar will use update() by default when working with iterables. If you're only going to loop a few times, you can force lowbar to use update_smooth():

for i in lowbar.LowBar(range(6), smooth_iter=True):
    time.sleep(1)

Note: You can't use log() when using lowbar with an iterable.


You can change the load fill and blank fill chars as well:

bar = lowbar.LowBar(bar_load_fill="O", bar_blank_fill=".")


Contributing

All contributions are welcome!

If you wish to report a bug or suggest a feature, open an issue.

If you already have a fix for a bug, make a pull request directly.

You can also vote on already suggested features.

See CONTRIBUTING.md for guidelines to follow.

Contributors are listed in CONTRIBUTORS.md.



License

MIT License

Copyright (c) 2022 AnnikaV9

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lowbar-1.3.5.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lowbar-1.3.5-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file lowbar-1.3.5.tar.gz.

File metadata

  • Download URL: lowbar-1.3.5.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for lowbar-1.3.5.tar.gz
Algorithm Hash digest
SHA256 61af91bb5a345823c0728aab435e2a1354dd454927e8d0897d2ecd77135290de
MD5 b252ee291c0a0bcde7a8e45d68095fa4
BLAKE2b-256 aab91f9dd725786bdc6c98423c532b16c12ff6f6f54bb6d777dea73bcf8a1f2f

See more details on using hashes here.

File details

Details for the file lowbar-1.3.5-py3-none-any.whl.

File metadata

  • Download URL: lowbar-1.3.5-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for lowbar-1.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 978e46464f3e3837a3e653677ed71699a8477d30cb93f1ccb78df3913ea7dc38
MD5 212334427e1568af2b86666aa05a82ad
BLAKE2b-256 267a2cdb93b31d700ef0c8f78352403b9de1523ec4b12e9437bd8f1c604b9847

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.1

2 files

2.2.0

2 files

2.0.0

2 files

1.5.3

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

This release

1.3.5 This release

2 files

1.2.5

2 files

1.1.5

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page