prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Drive `ProgressBar` with percentage?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Hi, and thanks for making such an awesome toolkit :)
I'm trying to use the ProgressBar API with a function that gives me a percentage-based callback, e.g.
def on_progress(percentage):
"""Called when the underlying blocking function has made progress"""
# Is there a way to update a ProgressBar here with the percentage?
def do_stuff():
"""Render a progress bar while a long-running blocking function runs."""
long_blocking_function(on_progress=on_progress)
It looks like the ProgressBar API is structured around work to do. I have the opposite case; I'm not sure how many things there are to do, but I know exactly what percentage of the way through I am :)
Is there a way to do this?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing ProgressBar API and its usage patterns, then trace how progress updates are represented when the total amount of work is known. Confirm the intended behavior for percentage callbacks and define completion as a usable way to drive the bar without a known total; the issue names no files or tests to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100