-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
API: Use class-based directive in sphinxext #13138
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
@@ -176,9 +177,10 @@ | |||
|
|||
def plot_directive(name, arguments, options, content, lineno, | |||
content_offset, block_text, state, state_machine): | |||
"""Implementation of the ``.. plot::`` directive. | |||
"""Deprecated function-based implementation of the ``.. plot::`` directive. |
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.
Use @cbook.deprecated("3.1", alternative="PlotDirective")
to mark deprecation rather than editing the docstring (the decorator will edit it for you).
|
||
app.add_directive('plot', plot_directive, True, (0, 2, False), **options) | ||
# Old, function-based method was equivalent to: | ||
# app.add_directive('plot', plot_directive, True, (0, 2, False), |
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.
would suggest just deleting it
@@ -273,7 +295,8 @@ def setup(app): | |||
|
|||
app.connect('doctree-read', mark_plot_labels) | |||
|
|||
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} | |||
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True, | |||
'version': 0.2} |
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.
Seems better to just track the matplotlib version here.
PR Summary
Changes
matplotlib.sphinxext.plot_directive
to use class-based mechanics instead of the deprecated function interface. I have verified building the SciPy doc looks the same before and after this change, and that having an error in the code emits the same warning/error in both cases. But I guess we'll see how thematplotlib
doc builds (assuming it's built by CI)!I also added a
version
to the.. plot::
config settings, and set to0.2
(previously was unset, so I assumed it to be0.1
).Closes #13132.
PR Checklist
One question -- I put the API changes stuff in a new file because I assume it's going in the next release rather than 3.0.1. Should
.github/PULL_REQUEST_TEMPLATE.md
be updated to mentiondoc/api/next_api_changes/
instead ofdoc/api/api_changes.rst
? If so I can add it here or make a new PR.