-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate positional passing of most Artist constructor parameters #23177
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
Conversation
0c6af5b
to
f6047ea
Compare
f6047ea
to
1958b10
Compare
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.
Just a few comments on where to start the keyword only part, but overall I think this is nice for requiring explicit keywords to be used and should help with the API management.
@@ -498,6 +498,8 @@ class PaddedBox(OffsetBox): | |||
The `.PaddedBox` contains a `.FancyBboxPatch` that is used to visualize | |||
it when rendering. | |||
""" | |||
|
|||
@_api.make_keyword_only("3.6", name="draw_frame") |
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.
Do you want to start at "pad" here? In AnchoredText/AnchoredBox you chose "pad".
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.
I'd leave this as proposed. If in doubt I try to err on the more permissive side, so that we don't overly constrain the API and force people to change still reasonable calls. For PaddedBox
pad
is quite canonical and I think we should still allow PaddedBox(child, 0.5)
. AnchoredText/AnchoredBox have other parameters before pad and pad as central a concept as it is with PaddedBox
.
lib/matplotlib/patches.py
Outdated
@@ -3916,6 +3927,7 @@ def __str__(self): | |||
return s % (self._x, self._y, self._width, self._height) | |||
|
|||
@_docstring.dedent_interpd | |||
@_api.make_keyword_only("3.6", name="bbox_transmuter") |
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.
Probably start this at boxstyle since bbox_transmuter is deprecated (you could remove that here even?).
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.
Started one later with mutation_scale
. Same argument with erring on the permissive side `FancyBboxPatch((0, 0), 5, 8, "round") is still sort of reasonable.
This should have very little impact on the practical use, as it's anyway error-prone to pass more than a few arguments by position. But enforcing keyword-only makes future API changes simpler for us.
1958b10
to
aee51c8
Compare
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.
I am 40/40/20 between leaving it as-is, leaving pad positional in AnchoredText/AnchoredBox , and making it keyword only in PaddedBbox.
@greglucas is OK with current state as discussed on the call. |
Follow up to and generalization of #23166.
This should have very little impact on the practical use, as it's anyway
error-prone to pass more than a few arguments by position. But enforcing
keyword-only makes future API changes simpler for us.