Skip to main content

A simple progress bar made primarily for my own personal use. Made from a combination of necessity and so much sloth that it overflowed into productivity.

Project description

smooth-progress

A simple progress bar made primarily for my own personal use. Was made out of a combination of necessity and being so lazy that I overflowed into being productive and instead of searching for a library that suited my needs, I wrote my own.

Installation

smooth-progress can be installed through pip. Either download the latest release from Codeberg/GitHub, or do pip install smooth-progress to install from PyPi. For the latest commits, check the dev branches on the repositories.

smooth-progress was written in Python 3.9, but should work with Python 3.5 and up. A minimum of 3.5 is required due to the project's use of type hinting, which was introduced in that version.

Usage

Usage of smooth-progress is, as it should be, quite simple.

The driving force of this module is the concept of "mutability", e.g., the openness of the progress bar to change. When the progress bar is mutable, or "open", it can be changed. When it is "closed" it cannot be changed, and will simply display its last state.

The ProgressBar model has four basic functions provided for your use:

  • ProgressBar.close(); closes the ProgressBar from mutability, displaying its final state.
  • ProgressBar.increment(); progresses the ProgressBar by 1. Should be called once per unit of whatever the bar is measuring.
  • ProgressBar.interrupt(); a more forceful version of .close(), closing the ProgressBar from mutability but without displaying its final state.
  • ProgressBar.open(); resets the ProgressBar and opens it to mutability.

In the near future, the plans are for .close() and .open() to be like pause and unpause functions, with .interrupt() ending the bar early and .reset() resetting its progress.

Here is a simple example to show how the bar is initialised and used:

import smooth_progress

bar = smooth_progress.ProgressBar(limit=100)
bar.open()
for i in range(0,100):
    bar.increment()
bar.close()

Note that the bar is not automatically opened. This is to prevent accidental changes to it if it is initialised before it should be used. In the future, capabilities will be in place to make the above code a little more succinct.

smooth_progress currently also defines one exception, smooth_progress.exceptions.ProgressBarClosedException, which is thrown if you attempt to increment the ProgressBar when it is not open.

Contributing

See the contribution guide.

Project details


Download files

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

Source Distribution

smooth_progress-0.2.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

smooth_progress-0.2.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file smooth_progress-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for smooth_progress-0.2.0.tar.gz
Algorithm Hash digest
SHA256 de38041283faae643d0a92bbb8966c37d1221d21be6d0d5b0222314179629451
MD5 b5230f121b68b653cc4a9e1a238359e6
BLAKE2b-256 692e9a1988ba1824a83c953a8c0b72ae8ac67950efe733526288db341ae7d282

See more details on using hashes here.

File details

Details for the file smooth_progress-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for smooth_progress-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ba498e9d83f29f851f7ef0feb7ea28787722a84c52425cfc9af05c99082dc4b
MD5 54d2db893084c0714d0ec0c89ff9ffd3
BLAKE2b-256 e8dbd194f72aa7ac358aca952950064ee3bd8f531617a17b07c95f420a5051c2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page