Skip to content

Add explicit getter / setter overloads for pyplot.{xlim,ylim} #30199

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

Merged
merged 7 commits into from
Jun 27, 2025

Conversation

ZPyrolink
Copy link
Contributor

PR summary

This PR update the tools/boilerplate.py for autogenerate getter / setter:

  • Axes.xlim
  • Axes.ylim
  • Any method with the following form: T.get_meth() -> TGet ; T.set_meth(...) -> TSet

PR checklist

- Create get_signature method
- Create AXES_GETTER_SETTER_TEMPLATE
- Create call_param method on generate_function

(cherry picked from commit e57b321)
(cherry picked from commit 64e7921)
(cherry picked from commit 66ee071)
@ZPyrolink ZPyrolink changed the title Pyplot get set automatization Pyplot getter setter automatization Jun 21, 2025
@ZPyrolink ZPyrolink mentioned this pull request Jun 21, 2025
2 tasks
@QuLogic
Copy link
Member

QuLogic commented Jun 24, 2025

I don't think the docstrings are correct here. Placing them on the overloads doesn't really produce both. What you end up with is the docstring to Axes.get_xlim, which is not the same as the removed docstring for xlim. If you want to automatically produce the overloads, that might be fine, but I don't think there's a way to generate a reasonable docstring on these.

@QuLogic
Copy link
Member

QuLogic commented Jun 24, 2025

Any method with the following form: T.get_meth() -> TGet ; T.set_meth(...) -> TSet

You've mentioned these as well, but it seems like this PR only changed xlim/ylim?

@timhoffm
Copy link
Member

I think the added complexity of the auto-generation is not not worth it, in particular given that we want a different docstring. As proposed in #30160 (comment) writing out the signature manually and/or adding overloads should be good enough.

@ZPyrolink ZPyrolink changed the title Pyplot getter setter automatization Add explicit getter / setter overloads for pyplot.{xlim,ylim} Jun 24, 2025
@QuLogic QuLogic merged commit e36bffb into matplotlib:main Jun 27, 2025
40 checks passed
@github-project-automation github-project-automation bot moved this from Needs review to Waiting for author in First Time Contributors Jun 27, 2025
@QuLogic QuLogic moved this from Waiting for author to Merged in First Time Contributors Jun 27, 2025
@QuLogic QuLogic added this to the v3.11.0 milestone Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

[MNT]: pyplot type hints
4 participants