Skip to main content

lowbar

The simplest no-nonsense progress bar for python.

Preview GIF

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.

lowbar has:

  • Automatic resizing
  • Manual progress management
  • Automatic progress management (As an iterable)
  • Text logging
  • Bar styling
  • Low overhead
  • Small size ( < 150 lines)

lowbar doesn't have:

  • Nested bars
  • Fancy animations
  • ETA calculations

Requirements

  • Python 3.7 or above. lowbar may support earlier versions, but this has not been tested.
  • A console that supports line feed \n and carriage return \r.

Installation

Install the latest stable release:

pip install lowbar

Or the development version:

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

Usage

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

from lowbar import lowbar

And initialize the bar:

bar = 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.add(20)

If we have a known number of tasks, lowbar can automatically calculate the percentage for us:

bar.next(n_tasks)

[!NOTE] If you set the number of tasks when initializing lowbar with lowbar(n_tasks), you don't need to pass n_tasks to next().

We can also set the completion percentage instead of adding to it:

bar.update(50)

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(10)
bar.new()
for i in range(10):
    time.sleep(0.5)  # task
    bar.log(f"Task {i+1} completed")
    bar.next()
bar.clear()

print("Tasks complete!")

You don't even need a loop:

bar.new()
time.sleep(0.5)  # task
bar.add(10)
time.sleep(0.5)  # task
bar.add(10)
time.sleep(0.5)  # task
bar.update(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(2) as bar:
    time.sleep(0.5)  # task
    bar.next()
    time.sleep(0.5)  # task
    bar.next()

print("Tasks complete!")

To make things simpler, you can wrap lowbar around range() and turn it into an iterable. It will automatically calculate how much to increase the percentage by every loop:

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

Pass an integer and lowbar will convert it into a range object for you:

for i in lowbar(100):
    time.sleep(0.5)  # task

[!NOTE] You can't use log() when using lowbar as an iterable.

You can also change the load fill and blank fill chars:

bar = lowbar(load_fill="O", blank_fill=".")

Or add a description text to the left side of the bar:

bar = lowbar(desc="Downloading...")

[!NOTE] If the console is too small to accommodate both the bar and the description text, the text will be hidden.


See the reference for more details.

Contributing

All contributions are welcome!

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

You can also make a pull request directly if you already have the fix for a bug.

See CONTRIBUTING.md for guidelines to follow.

Contributors are listed in CONTRIBUTORS.md.

License

This project is licensed under the MIT License.

Release files for lowbar 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lowbar 2.2.1
File Size Uploaded
lowbar-2.2.1.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lowbar 2.2.1
File Interpreter ABI Platform
lowbar-2.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / lowbar-2.2.1.tar.gz

Download URL lowbar-2.2.1.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9df3ff4a8a94f4f5345c9e325516ae21333d0e23a773ea2c04e9e9a26771bb72
BLAKE2b-256 checksum
How to use checksums
d358de03d077252647d75e8ee4d6d3a157c063c050f49df70c8f9a5991e19575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / lowbar-2.2.1-py3-none-any.whl

Download URL lowbar-2.2.1-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16067a4e34f4c9e475db647c8ab0fd1e9bc60bc0d2f64b36bd626e79eb492243
BLAKE2b-256 checksum
How to use checksums
39571b85d1fc4520616dfbfe0f33f884c57f61495220542a7a9a77f6e304dda9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.0.0

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.5

2 release files

1.2.5

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release 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