Skip to content

fix: progress_bar increments past total when range has step > 1#9735

Open
sridhar-3009 wants to merge 2 commits into
marimo-team:mainfrom
sridhar-3009:fix/progress-bar-range-step
Open

fix: progress_bar increments past total when range has step > 1#9735
sridhar-3009 wants to merge 2 commits into
marimo-team:mainfrom
sridhar-3009:fix/progress-bar-range-step

Conversation

@sridhar-3009
Copy link
Copy Markdown

What

mo.status.progress_bar(range(0, 10, 2)) reached current = 10 against total = 5, producing an impossible state in the UI.

Why

total is correctly derived from len(range) (= 5 iterations), but each loop tick was incrementing current by range.step (= 2). After 5 iterations: current = 10 > total = 5.

Fix

Remove the self.step = range.step override. Progress always advances by 1 per iteration, consistent with the len()-derived total.

Test

Added test_progress_range_with_step that asserts current == total after iterating over range(0, 10, 2).

Fixes #9575

When iterating over range(start, stop, step), len(range) correctly
counts the number of iterations, but each loop tick was incrementing
current by step instead of 1, causing current to exceed total and
produce impossible states (e.g., 10/5).

Remove the self.step override for range objects; progress always
advances by 1 per iteration, matching the len()-derived total.

Fixes marimo-team#9575
@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment May 31, 2026 8:05am

Request Review

@github-actions
Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mo.status.progress_bar should use the step property of 'range'

1 participant