holdon
Holdon, pronounced "hold'n," is a lightweight Python progress bar library with a simple API.
$ pip install holdon
Get Started
Holdon is like tqdm, just wrap progress() around an iterator and we're good to go.
import time
from holdon import progress
for i in progress(range(100)):
time.sleep(0.1)
23.0% ━━━╸━━━━━━━━━━━━━━━━ 23 / 100 (9.9it/s)
If you do not have any iterator, you can use class RawProgress() and update everything manually. To learn more, refer to the documentation below.
Documentation
Minimal, lol.
def progress()
progress(
iterator: Iterator,
*,
width: Optional[int] = None,
size: Optional[int] = None,
unit: Literal["it", "bytes"] = "it"
) -> Iterator[Any]
Creates a progress bar.
Example:
You can wrap progress() around any iterator:
for i in progress(range(100)):
... # do your work here
You can also wrap it around a custom iterator, but you'll need to specify its total iterations.
words = ["cheese", "is", "good", "but", "i'm", "lactose", "intolerant"]
def word_it():
for word in words:
yield word + " "
for word in progress(word_it(), size=len(words)):
... # do your work here
Args:
- iterator (
Iterator): The iterator. For instance,rangeorlist. - width (
int, optional): Width of the progress bar. Defaults to 50. - size (
int, optional): Size of the iterator or thelen()of the iterator. - unit (
Literal["it", "bytes"]): Unit. Could be one of: "it" (iterations) or "bytes" (bytes).
class RawProgress
Attributes
- const fmt (
str): Progress bar format. - slots width (
int): Progress bar width. - slots size (
int): Total iterations as "size." - slots unit (
Literal["it", "bytes"]): Unit. Could be one of: "it" (iterations) or "bytes" (bytes).
__init__(
self,
width: int = 50,
size: int = 100,
unit: Literal["it", "bytes"] = "it"
)
The progress bar.
Example:
A minimal example:
rp = RawProgress()
for i in range(500):
rp.advance(1)
You can also change the unit parameter to "bytes" and specify the total content length (see requests) to indicate download progress:
rp = RawProgress(
unit="bytes",
size=int(http_response.headers['Content-Length'])
)
for chunk in http_response.iter_content():
rp.advance(len(chunk))
Args:
- width (
int): Progress bar width. - size (
int): Total iterations as "size." - unit (
Literal["it", "bytes"]): Unit. Could be one of: "it" (iterations) or "bytes" (bytes).
def RawProgress.advance()
advance(self, i: int = 1) -> None
Advance.
Args:
- i (
int): Advance size.
def RawProgress.render()
render(self) -> None
Renders the progress bar.
(c) 2024 AWeirdDev
Metadata
Release files for holdon 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| holdon-0.1.tar.gz | 5.4 kB | Without provenance | Details |
Release files / holdon-0.1.tar.gz
| Download URL | holdon-0.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07f3b6ba589f8034850350bdcbc0dc74f9198473f1744045b5651ddad479c8ae
|
|
BLAKE2b-256 checksum How to use checksums |
a8c9d8b65f9580fee4077a93a0f515f5e282d3d16691aa8187c6e8f76ad72d86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|
Security for holdon 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.