progrow
progrow is a Python package for graphing the progress of work across rows.
Installation
progrow requires Python 3.6 or later.
pip install progrow
Rendering a single row
from progrow import Row
row = Row("apple harvest", current=23, maximum=100)
print(row.render())
apple harvest ████████▉
Including fractions, percentages and other styles
An optional Style can be passed into render():
| Property | Description | Default |
|---|---|---|
color |
Render in colour | True |
name_suffix |
String to append after each row's name | " " |
show_fraction |
Include each row's fractional progress (<current> / <maximum>) |
False |
show_percent |
Include each row's percentage progress | False |
width |
Width to draw | Terminal width |
from progrow import Row, Style
row = Row("apple harvest", current=23, maximum=100)
style = Style(name_suffix=" progress: ", show_fraction=True, show_percent=True)
print(row.render(style=style))
apple harvest progress: ███▌ 23 / 100 • 23%
Rendering rows from a generator
from progrow import Row, Style
style = Style(show_fraction=True, show_percent=True)
for harvest in harvest_generator():
row = Row(harvest[0], current=harvest[1], maximum=harvest[2])
print(row.render(style=style))
apple harvest ███ 1 / 9 • 11%
banana harvest ██▍ 9 / 99 • 9%
caramel harvest ███████████████████▉ 100 / 100 • 100%
Since the rows are "streaming" in from a generator, the layout cannot be pre-calculated and the columns don't align.
To make this output prettier, create a Layout and guesstimate your columns:
| Property | Description |
|---|---|
left_fraction_length |
Width of the "current" part of the fraction. For example, 3 to accommodate a three-digit value. |
name_length |
Width of the name column. For example, 10 to accommodate a ten-character name. |
percent_length |
Width of the percentage column. For example, 3 to accommodate a two-digit value plus a % character. |
right_fraction_length |
Width of the "maximum" part of the fraction. For example, 3 to accommodate a three-digit value. |
from progrow import Layout, Row, Style
layout = Layout(
left_fraction_length=3,
name_length=16,
percent_length=4,
right_fraction_length=3,
)
style = Style(show_fraction=True, show_percent=True)
for harvest in harvest_generator():
row = Row(harvest[0], current=harvest[1], maximum=harvest[2])
print(row.render(layout, style))
apple harvest ██▏ 1 / 9 • 11%
banana harvest █▊ 9 / 99 • 9%
caramel harvest ███████████████████ 100 / 100 • 100%
Rendering rows from a list
When all the row data is available before rendering, create a Rows instance to have the layout calculated automatically.
from progrow import Rows, Style
rows = Rows()
rows.append("apple harvest", current=1, maximum=9)
rows.append("banana harvest", current=9, maximum=99)
rows.append("caramel harvest", current=100, maximum=100)
style = Style(show_fraction=True, show_percent=True)
print(rows.render(style))
apple harvest ██▎ 1 / 9 • 11%
banana harvest █▊ 9 / 99 • 9%
caramel harvest ███████████████████▉ 100 / 100 • 100%
Thank you! 🎉
My name is Cariad, and I'm an independent freelance DevOps engineer.
I'd love to spend more time working on projects like this, but--as a freelancer--my income is sporadic and I need to chase gigs that pay the rent.
If this project has value to you, please consider ☕️ sponsoring me. Sponsorships grant me time to work on your wants rather than someone else's.
Thank you! ❤️
Metadata
Release files for progrow 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| progrow-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for progrow-1.0.1-py3-none-any.whl |
Release files / progrow-1.0.1-py3-none-any.whl
| Download URL | progrow-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
127eab71bd6097f99ea232c3be157bc405cba322f4067f8ebb5a9a951240e21d
|
|
BLAKE2b-256 checksum How to use checksums |
2ca76ded92bef66939016952c9c28db66f41ad6739aa088abf2b5a00c072511a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
|
Security for progrow 1.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.