Skip to main content

lowbar

The simplest no-nonsense progress bar for python.

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.update(20)

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:

completion = 0
bar.new()
for i in range(10):
    time.sleep(2)  # task
    bar.log(f"Task {i+1} completed")
    completion += 10
    bar.update(completion)
bar.clear()

print("Tasks complete!")

You don't even need a loop:

bar.new()
time.sleep(1)  # task
bar.update(10)
time.sleep(2)  # task
bar.update(40)
time.sleep(2)  # 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() as bar:
    time.sleep(1)  # task
    bar.update(10)
    time.sleep(3)  # task
    bar.update(100)

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

To make things even more simpler, you can 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.

Parameters

__init__()

Called when the lowbar object is created.

Parameter Type Description Default
bar_iter range A range object that lowbar will iterate through when __iter__() is called. If an integer is provided, lowbar converts it into a range object. 0
load_fill str A single-character string used to fill the bar as it loads. "#"
blank_fill str A single-character string used to fill the unloaded part of the bar. "-"
desc str Text displayed to the left of the bar. If the console is too small, this text will be hidden. ""
remove_ends bool Hides the characters at both ends of the bar ([ & ]). False
keep_receipt bool Prevents lowbar from automatically clearing the bar after completion (useful for keeping the progress bar as a 'receipt'). False

new()

Alias for update(0).

update()

Increases or decreases the completed percentage and refreshes the bar, resizing if the console size changes.

Parameter Type Description Default
percentage int The percentage to set as the completed progress. No default

log()

Logs text to the console without affecting the bar.

Parameter Type Description Default
text str The text to log. Other types must be converted to strings before logging. No default

clear()

Clears the currently active bar.

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.

Download files

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

Source Distribution

lowbar-2.0.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

lowbar-2.0.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lowbar-2.0.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for lowbar-2.0.0.tar.gz
Algorithm Hash digest
SHA256 2b3ef520a2ab9875b092b376468211ea94008399acb9bf48b897522351fdcbd7
MD5 6e32c481ef36b3ca0f629baaf5250651
BLAKE2b-256 930459d410196083369a0977ed7301e9b2bbaeafd2971099156f5a81d25aef1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lowbar-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for lowbar-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12282134723d6b7bfde97fa23e4576d64cf1426218aa1eb26cb7fb1b3a5bbc2f
MD5 19eab1862da175a791f4f575fa04f44f
BLAKE2b-256 20dee8694d235c09d7111755e2b37db82724f4bce6b6f164106a74f653fc0b71

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.1

2 files

2.2.0

2 files

This release

2.0.0 This release

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

1.3.5

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