-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Reduce do_3d_projection deprecation warnings in external artists #21741
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
Reduce do_3d_projection deprecation warnings in external artists #21741
Conversation
Previously, when finding the 3D zorder, external artists were assumed to use the calling convention of `Patch3D.do_3d_projection` from Matplotlib 3.3, where it took a positional `renderer` parameter. This triggered a deprecation warning, even if the artist could support the new convention. Now we attempt to bind the signature first, and only emit a deprecation warning if the calling convention does not appear to work.
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 while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. 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.
Thanks for working on this! This overlaps with #21704 where I took the more direct "try and see if it works" path. @jakelishman Would you be willing to extract the tests from that PR to this one? I think this PR has a marginally better implementation because it drops the special-case for our internal artists, but we still need to adjust the deprecation version. |
Co-authored-by: Thomas A Caswell <[email protected]>
Ah sorry, I missed #21704 when I was searching to see if the issue was already reported. I've incorporated the same sort of tests in 53e124b, including the |
…nings in external artists
Thanks @jakelishman! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again. |
…741-on-v3.5.x Backport PR #21741 on branch v3.5.x (Reduce do_3d_projection deprecation warnings in external artists)
PR Summary
Previously, when finding the 3D zorder, external artists were assumed to
use the calling convention of
Patch3D.do_3d_projection
from Matplotlib3.3, where it took a positional
renderer
parameter. This triggereda deprecation warning, even if the artist could support the new
convention. Now we attempt to bind the signature first, and only emit a
deprecation warning if the calling convention does not appear to work.
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).Fix #21740.
The original logic this modifies was introduced in #18302, where there was a comment that this was deliberately avoiding signature parsing to make things simpler. However, with the new calling convention only being used if the
Artist.__module__
ismplot3d
-internal, this meant that library code (e.g. Qiskit/qiskit#7301) could not avoid triggering the deprecation warning, even if downstreamArtist
did actually fulfill the convention. Since the warnings are triggered during the drawing phase, which may well be outside library control, we couldn't suppress the warnings without changing global user filters.If the performance hit from using
signature.bind
is too heavy, it could also do