added raise condition and grouped Tick constructor parameters#26037
added raise condition and grouped Tick constructor parameters#26037madeira-dev wants to merge 5 commits into
Conversation
… into refact_kwargs_tick
| remaining_kwargs = { | ||
| k: v for k, v in kwargs.items() if not k.startswith('grid_')} | ||
| if remaining_kwargs: | ||
| raise ValueError(f"Invalid kwargs: {remaining_kwargs.keys()}") |
There was a problem hiding this comment.
This probably should start as a warning for a cycle? On one hand I hope these is no usage of this in the wild (it is not documented and users should not be making Tick directly!), but on the other we tend to be very conservative about this sort of thing.
Eitherway, this needs an API change note.
There was a problem hiding this comment.
Where and what should I write about in the API change note?
Should I write about changing it to raise in the next cycle?
There was a problem hiding this comment.
@tacaswell IMHO this does not need an API-change note and could even directly error instead of warn. There is no reasonable code that is currently working and will break through the change. One would have to have passed a different 5-char prefix such as GRID_alpha / gridsalpha / line_alpha. But all of that would be completely made up by the user. That this works is just a current implementation detail and we haven't documented or provided any guarantees on it.
| grid_linestyle=None, | ||
| grid_linewidth=None, | ||
| grid_alpha=None, | ||
| size=None, width=None, color=None, major=True, pad=None, zorder=None, # global |
There was a problem hiding this comment.
The size in points info must stay.
I'd have a slight preference to keep the one-parameter-per-line format and reorder in there:
# global
size=None, # points
width=None,
...
# tick props
tickdir=None,
...
But that's personal taste and not a blocker.
There was a problem hiding this comment.
I agree about the size in points comment staying.
|
I will defer to @timhoffm here and skip the warning/deprecation cycle, but the text of the error raised should explain what is going on and what changed rather than just saying "invalid". |
|
@madeira-dev Do you want to continue on this? |
PR summary
closes #26008
Grouped constructor parameters as described in issue
and created raise condition
PR checklist