Skip to main content

lowbar

The simplest no-nonsense loading bar for python.



demo.py

# All the sleep calls would be tasks to
# complete in a real program

import lowbar, time, random
bar = lowbar.LowBar()
completion = 0
for i in range(10): time.sleep(random.random()) bar.update_smooth(completion) bar.log(f"Task {i+1} completed") completion += 10 bar.clear()
print("\nRunning checks...") bar.update(0) 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!")



Installation

Install the latest stable release:

pip install lowbar

Or build the development version in this repository:

pip install build hatchling
python3 -m build -w
pip install dist/lowbar-*-py3-none-any.whl


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, simple update the completion percentage:

bar.update(0)

We start with 0 since our program hasn't completed anything yet.


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)

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:

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

You don't even need a loop:

import lowbar, time
bar = lowbar.LowBar()
bar.update(0)
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!")

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 to report a bug or suggest a feature, open an issue.

You can also make a pull request directly.



License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

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 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.

For more information, please refer to <https://unlicense.org>

Download files

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

Source Distribution

lowbar-0.1.7.tar.gz (4.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-0.1.7-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lowbar-0.1.7.tar.gz
Algorithm Hash digest
SHA256 e035af369b55be64fd3988f248f5b9a55253b7328bec463dc8feccf0f4cc73d2
MD5 0661f52b7da1bbb571081a95c6012508
BLAKE2b-256 8e3785efe1a6645d9ee5ad60ca3e88508d0ccba3f21e405f0740dff3f2b11fa3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for lowbar-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3afd8945752ab27521c8a4429dcf961b6522de78b4cd6f410680c44d82d8ec34
MD5 f0c47fe5745c5abcd75ca4189d8e1044
BLAKE2b-256 4bfc822854bdccd36414717c05cb2bc571fae13a24024e8263d9565c1a1a790f

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

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

This release

0.1.7 This release

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