Skip to content

Allow custom spinners across rich library #3791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

MaddyGuthridge
Copy link

@MaddyGuthridge MaddyGuthridge commented Jul 12, 2025

Type of changes

  • New feature
  • Documentation / docstrings
  • Tests

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review. (I am keen!)

Description

Resolves #3790

The feature

  • Adds type definition to spinner animation dictionary
  • Allows a custom spinner animation parameter in place of a spinner name, allowing users to specify their very own animations if they desire
  • This is implemented in Spinner, Console.status, Status and progress.SpinnerColumn (let me know if I missed anything)

Documentation

  • I documented custom spinner support in console.rst
  • Spinners don't have their own dedicated documentation page. Should one be added? If so, this should be documented there.
  • Notably, all tests still pass.

Is this worth adding despite Rich rejecting most new features?

  • Imo this feature is worthwhile adding, since it cannot easily be added through a third-party library (unless that library reimplements spinners as a whole). Imo this makes it easier to extend the core library.
  • This shouldn't break backwards compatibility, as all changed function parameters still accept their original types, as well as the new types.

Design considerations

  • In an ideal world, all these functions would accept a Spinner object themselves, rather than their assorted set of other parameters (spinner, spinner_style and speed), which would make patterns like dependency injection simpler
  • However, accepting a Spinner object (rather than constructing one based on these parameters) would make those other parameters ambiguous in the case where a Spinner object is given.
  • As such, this design is probably the best for fitting with the existing code-base, and avoiding confusion and breaking changes.

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.

[REQUEST] Custom spinner animation
1 participant