feat: add Spinner.done() for checkmark transition#9946
Conversation
Implements the TODO(akshayka) for adding a done() method that turns
the spinner into a checkmark when completed.
Changes:
- Add mark_done() to _Progress base class (thread-safe)
- Add done() convenience method to Spinner class
- Pass done state to frontend via _get_text()
- Frontend: show CheckCircle2Icon when done=true
- Context manager: auto-transition to done when remove_on_exit=False
- Tests: 5 new test cases covering all scenarios
Usage:
with mo.status.spinner('Loading ...') as s:
data = load_data()
s.done(title='Done!')
Closes: #<issue>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
All contributors have signed the CLA ✍️ ✅ |
for more information, see https://pre-commit.ci
|
I have read the CLA Document and I hereby sign the CLA |
|
Thanks for the contribution! This is a clean and user-friendly enhancement that addresses both TODOs left in the codebase. I particularly like: The thread-safe implementation via mark_done() A few points worth double-checking during review: Ensure the serialized payload remains backward compatible for clients that may not yet recognize the done field. Overall, the feature is well-scoped, resolves the referenced TODOs, and includes appropriate test coverage. Nice work! |
3391328 to
2fea6b5
Compare
|
@akshayka, could you please review this PR when you have a chance? It implements the two Spinner completion TODOs and handles exceptional context exits without showing a success state. Thank you. |
|
@allin2 do you have a use case for this? Feature requests need to be discussed with the team via a GitHub issue before submitting a PR for review |
|
@allin2 - do you think if we had like 4 items in a workflow where each item ended in a check mark, we could see all 4 check marks in the UI? |
|
Closing due to lack of response |
This pull request was authored by a coding agent.
Description
Adds
Spinner.done(), which transitions a spinner from its loading animation to a checkmark. This resolves two TODOs by @akshayka:done()method that turns the spinner into a checkmark.Changes
Python (
marimo/_plugins/stateless/status/_progress.py)_is_doneflag to the_Progressbase class.mark_done()method.Spinner.done()as the public convenience method.donestate for the frontend.TypeScript (
frontend/src/plugins/layout/ProgressPlugin.tsx)donestate to the data interface and Zod validator.CheckCircle2Iconinstead of the loading indicator whendone=true.Tests (
tests/_plugins/stateless/status/test_progress.py)done()updates completion state, title, and subtitle.done()without arguments preserves the existing title and subtitle.done()after close raisesRuntimeError.remove_on_exit=Trueclears the spinner.remove_on_exit=Falsetransitions to done.remove_on_exit=Falseclears the spinner without marking it done.Usage
Validation
tests/_plugins/stateless/status/test_progress.py: 21 passed.no-double-backticks-in-docstrings: passed.I have read the CLA Document and I hereby sign the CLA.