Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 4 commits into from
Jan 10, 2019

Conversation

larsoner
Copy link
Contributor

@larsoner larsoner commented Jan 9, 2019

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 the matplotlib doc builds (assuming it's built by CI)!

I also added a version to the .. plot:: config settings, and set to 0.2 (previously was unset, so I assumed it to be 0.1).

Closes #13132.

PR Checklist

  • Has Pytest style unit tests (implicitly any existing tests have been updated)
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

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 mention doc/api/next_api_changes/ instead of doc/api/api_changes.rst? If so I can add it here or make a new PR.

@larsoner
Copy link
Contributor Author

larsoner commented Jan 9, 2019

CircleCI output looks reasonable on this PR compared to master.

@@ -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.
Copy link
Contributor

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),
Copy link
Contributor

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}
Copy link
Contributor

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.

@tacaswell tacaswell added this to the v3.1 milestone Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants