GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow `None` in set_prop_cycle (in type hints) by vnmabus · Pull Request #29920 · matplotlib/matplotlib

Conversation

@vnmabus

@vnmabus vnmabus commented Apr 15, 2025

Copy link
Copy Markdown
Contributor

PR summary

set_prop_cycle allows to pass None for resetting the cycle, but with the current type hints, type checkers give an error for this case.

PR checklist

  • [N/A] "closes #0000" is in the body of the PR description to link the related issue
  • [N/A] new and changed code is tested
  • [N/A] Plotting related features are demonstrated in an example
  • [N/A] New Features and API Changes are noted with a directive and release note
  • [N/A] Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vnmabus
Allow None in set_prop_cycle
baad0f4
`set_prop_cycle` allows to pass `None` for resetting the cycle, but with the current type hints, type checkers give an error for this case.
@github-actions github-actions Bot added the topic: axes label Apr 15, 2025
@vnmabus vnmabus changed the title Allow None in set_prop_cycle Allow None in set_prop_cycle (in type hints) Apr 15, 2025
github-actions[bot]
github-actions Bot reviewed Apr 15, 2025
View reviewed changes

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@QuLogic QuLogic added the topic: typing label Apr 15, 2025
@QuLogic

QuLogic commented Apr 16, 2025

Copy link
Copy Markdown
Member

Can you also fix the docstring for set_prop_cycle? It has a type of only ~.cycler.Cycler (and should get or None as well), which is probably where this type hint came from. (Though it does mention None in the description.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vnmabus
Add None to set_prop_cycle docstring
418c572
Add `None` to the docstring as a request from the maintainers.
@vnmabus

vnmabus commented Apr 16, 2025

Copy link
Copy Markdown
Contributor Author

Can you also fix the docstring for set_prop_cycle? It has a type of only ~.cycler.Cycler (and should get or None as well), which is probably where this type hint came from. (Though it does mention None in the description.)

I just did that. Maybe in the future it would make sense to add the types directly to the code (instead of using stubs) and remove the types from the docstrings, because these are not checked and can be easily out of sync with the actual types. Sphinx can add the types to the generated docs if you do it that way, and if you want to preserve the current presentation format maybe that can be done through a Sphinx plugin. What is the official stance of Matplotlib on this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

QuLogic
QuLogic approved these changes Apr 16, 2025
View reviewed changes
@QuLogic QuLogic added this to the v3.10.2 milestone Apr 17, 2025
timhoffm
timhoffm approved these changes Apr 17, 2025
View reviewed changes
@timhoffm
timhoffm merged commit f017a0e into matplotlib:main Apr 17, 2025
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Apr 17, 2025
@timhoffm @meeseeksmachine
Backport PR matplotlib#29920: Allow None in set_prop_cycle (in type…
54d6615
… hints)
@meeseeksmachine meeseeksmachine mentioned this pull request Apr 17, 2025
Backport PR #29920 on branch v3.10.x (Allow None in set_prop_cycle (in type hints)) #29932
Merged
@timhoffm

timhoffm commented Apr 17, 2025

Copy link
Copy Markdown
Member

When introducing typing, we decided to go with type stubs for several reasons. I would not say that this is set in stone forever, but there are currently no plans to change it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ksunden ksunden mentioned this pull request May 9, 2025
merge up 3.10.3 #30031
Closed
5 tasks
@ksunden ksunden mentioned this pull request Jul 25, 2025
Manual Backport PR #30195 on branch v3.10.x (ci: Enable wheel builds on Python 3.14) #30356
Merged
5 tasks
@ksunden ksunden mentioned this pull request Aug 7, 2025
merge up v3.10.5 #30401
Merged
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@github-actions github-actions[bot] github-actions[bot] left review comments
@QuLogic QuLogic QuLogic approved these changes
@timhoffm timhoffm timhoffm approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic: axes topic: typing

Projects

None yet

Milestone

v3.10.3

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vnmabus @QuLogic @timhoffm
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.