From fdf97c14d517e2d3f38068732427145e9339204b Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 10 Dec 2013 08:39:02 -0500 Subject: [PATCH 1/3] Deprecate IPython-related Sphinx extensions --- lib/matplotlib/sphinxext/ipython_console_highlighting.py | 8 ++++++++ lib/matplotlib/sphinxext/ipython_directive.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/matplotlib/sphinxext/ipython_console_highlighting.py b/lib/matplotlib/sphinxext/ipython_console_highlighting.py index 4d32e9abaf33..57f691712935 100644 --- a/lib/matplotlib/sphinxext/ipython_console_highlighting.py +++ b/lib/matplotlib/sphinxext/ipython_console_highlighting.py @@ -23,6 +23,14 @@ from sphinx import highlighting +import warnings +warnings.warn(""" +The Sphinx extension ipython_console_highlighting has moved from +matplotlib to IPython, and its use in matplotlib is deprecated. +Change your import from 'matplotlib.sphinxext.ipython_directive' to +'IPython.sphinxext.ipython_directive.""", +matplotlib.cbook.mplDeprecation) + #----------------------------------------------------------------------------- # Global constants line_re = re.compile('.*?\n') diff --git a/lib/matplotlib/sphinxext/ipython_directive.py b/lib/matplotlib/sphinxext/ipython_directive.py index 69cefd99d5c8..a938f87fabed 100644 --- a/lib/matplotlib/sphinxext/ipython_directive.py +++ b/lib/matplotlib/sphinxext/ipython_directive.py @@ -80,6 +80,14 @@ matplotlib.use('Agg') +import warnings +warnings.warn(""" +The Sphinx ipython_directive has moved from matplotlib to IPython, and +its use within matplotlib is deprecated. Change your import from +'matplotlib.sphinxext.ipython_directive' to +'IPython.sphinxext.ipython_directive.""", +matplotlib.cbook.mplDeprecation) + # Our own try: from IPython import Config, InteractiveShell From 0c457024266230fb1cbb720a1b40bdebd095db80 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 11 Dec 2013 10:10:23 -0500 Subject: [PATCH 2/3] Use matplotlib.cbook.warn_deprecated --- .../sphinxext/ipython_console_highlighting.py | 7 +++---- lib/matplotlib/sphinxext/ipython_directive.py | 12 +++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/matplotlib/sphinxext/ipython_console_highlighting.py b/lib/matplotlib/sphinxext/ipython_console_highlighting.py index 57f691712935..0ba9cab40307 100644 --- a/lib/matplotlib/sphinxext/ipython_console_highlighting.py +++ b/lib/matplotlib/sphinxext/ipython_console_highlighting.py @@ -22,14 +22,13 @@ from pygments.token import Comment, Generic from sphinx import highlighting +import matplotlib -import warnings -warnings.warn(""" +matplotlib.cbook.warn_deprecated("1.4", """ The Sphinx extension ipython_console_highlighting has moved from matplotlib to IPython, and its use in matplotlib is deprecated. Change your import from 'matplotlib.sphinxext.ipython_directive' to -'IPython.sphinxext.ipython_directive.""", -matplotlib.cbook.mplDeprecation) +'IPython.sphinxext.ipython_directive.""") #----------------------------------------------------------------------------- # Global constants diff --git a/lib/matplotlib/sphinxext/ipython_directive.py b/lib/matplotlib/sphinxext/ipython_directive.py index a938f87fabed..01c64a3ce721 100644 --- a/lib/matplotlib/sphinxext/ipython_directive.py +++ b/lib/matplotlib/sphinxext/ipython_directive.py @@ -80,13 +80,11 @@ matplotlib.use('Agg') -import warnings -warnings.warn(""" -The Sphinx ipython_directive has moved from matplotlib to IPython, and -its use within matplotlib is deprecated. Change your import from -'matplotlib.sphinxext.ipython_directive' to -'IPython.sphinxext.ipython_directive.""", -matplotlib.cbook.mplDeprecation) +matplotlib.cbook.warn_deprecated("1.4", """ +The Sphinx extension ipython_console_highlighting has moved from +matplotlib to IPython, and its use in matplotlib is deprecated. +Change your import from 'matplotlib.sphinxext.ipython_directive' to +'IPython.sphinxext.ipython_directive.""") # Our own try: From 0cdac1e5c58a9f34179d25115c414c39e3ae4430 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 11 Dec 2013 10:10:36 -0500 Subject: [PATCH 3/3] Add CHANGELOG entry. --- doc/api/api_changes.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 76f328f3ecb3..7e70a16e68c7 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -47,6 +47,12 @@ original location: - mstream -> `from matplotlib import stream as mstream` - mtable -> `from matplotlib import table as mtable` +* The Sphinx extensions `ipython_directive` and + `ipython_console_highlighting` have been moved to the IPython + project itself. While they remain in matplotlib for this release, + they have been deprecated. Update your extensions in `conf.py` to + point to `IPython.sphinxext.ipython_directive` instead of + `matplotlib.sphinxext.ipython_directive`. * In :module:`~matplotlib.finance`, almost all functions have been deprecated and replaced with a pair of functions name `*_ochl` and `*_ohlc`. The former is