From 2ac7b881728d761b137a75ad057d89263cab71ad Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Mon, 26 Nov 2012 00:30:13 -0800 Subject: [PATCH 1/5] deprecate undocumented `matplotlib/mpl.py` `matplotlib/mpl.py` is a file which used to get imported via ipython's `%pyplot` interface as module named `mpl`, yet it isn't clear at all what it's role is. Given that in our own code, and in the rest of our python neighborhood, we often do `import matplotlib as mpl`, it's quite a bit confusing to have something with the `mpl` name within matplotlib not be the `matplotlib` module itself. This module was only used in `pylab` interface, where it was simply imported in one line via `from matplotlib import mpl` and never used again. With the exception of mpl.finance, all of the modules in mpl.py were readily available simply via "import matplotlib as mpl". pylab's mpl.finance functionality is retained for backwards compatability. --- CHANGELOG | 4 ++++ lib/matplotlib/mpl.py | 5 +++++ lib/matplotlib/pylab.py | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 0e208c93b4d7..e74287530db1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -17,6 +17,9 @@ This allows backends to utilize additional text attributes, like the alignment of text elements. - pwuertz +2012-11-26 deprecate matplotlib/mpl.py, which was used only in pylab.py and is + now replaced by the more suitable `import matplotlib as mpl`. - PI + 2012-11-16 plt.set_cmap no longer throws errors if there is not already an active colorable artist, such as an image, and just sets up the colormap to use from that point forward. - PI @@ -27,6 +30,7 @@ color so that any alpha set by markerfacecolor will respected. - Thomas Caswell +>>>>>>> deprecate undocumented `matplotlib/mpl.py` 2012-11-13 Add a symmetric log normalization class to colors.py. Also added some tests for the normalization class. Till Stensitzki diff --git a/lib/matplotlib/mpl.py b/lib/matplotlib/mpl.py index 50f317f101d9..466cf6fcb4c9 100644 --- a/lib/matplotlib/mpl.py +++ b/lib/matplotlib/mpl.py @@ -1,3 +1,8 @@ +import warnings +warnings.warn( + "matplotlib.mpl is deprecated and will be removed in the next release." + "Please use `import matplotlib as mpl` instead", + DeprecationWarning) from matplotlib import artist from matplotlib import axis from matplotlib import axes diff --git a/lib/matplotlib/pylab.py b/lib/matplotlib/pylab.py index f5016019ab40..816b0dbb67d5 100644 --- a/lib/matplotlib/pylab.py +++ b/lib/matplotlib/pylab.py @@ -219,7 +219,10 @@ from matplotlib.cbook import flatten, is_string_like, exception_to_str, \ silent_list, iterable, dedent -from matplotlib import mpl # pulls in most modules +import matplotlib as mpl +# make mpl.finance module available for backwards compatability, in case folks +# using pylab interface depended on not having to import it +import matplotlib.finance from matplotlib.dates import date2num, num2date,\ datestr2num, strpdate2num, drange,\ From d7001521b44da74e6881a4a2998e9a0127e8ad7c Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Fri, 14 Dec 2012 13:00:15 -0800 Subject: [PATCH 2/5] move to the new MatplotlibDeprecationWarning --- lib/matplotlib/mpl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/mpl.py b/lib/matplotlib/mpl.py index 466cf6fcb4c9..b1cc1d101b45 100644 --- a/lib/matplotlib/mpl.py +++ b/lib/matplotlib/mpl.py @@ -1,8 +1,8 @@ import warnings +from matplotlib import MatplotlibDeprecationWarning as mDeprecation warnings.warn( "matplotlib.mpl is deprecated and will be removed in the next release." - "Please use `import matplotlib as mpl` instead", - DeprecationWarning) + "Please use `import matplotlib as mpl` instead", mDeprecation) from matplotlib import artist from matplotlib import axis from matplotlib import axes From d277c4ef3bf774463351d53cd276d139872975e6 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Fri, 14 Dec 2012 13:31:43 -0800 Subject: [PATCH 3/5] added deprecation note to API changes --- doc/api/api_changes.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 56fe16dca6bc..68f818b3ea68 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -24,6 +24,9 @@ Changes in 1.3.x :class:`~matplotlib.colorbar.ColorbarBase` allows one to control the shape of colorbar extensions. +* The `~matplotlib.mpl` module is now deprecated. Those who relied on this + module should transition to simply using `import matplotlib as mpl`. + Changes in 1.2.x ================ From 6511650e360a8259f8fae3091f613aa40db4375f Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Mon, 17 Dec 2012 16:16:46 -0800 Subject: [PATCH 4/5] use mplDeprecation convention --- lib/matplotlib/mpl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/mpl.py b/lib/matplotlib/mpl.py index b1cc1d101b45..969a0dc4b380 100644 --- a/lib/matplotlib/mpl.py +++ b/lib/matplotlib/mpl.py @@ -1,8 +1,8 @@ import warnings -from matplotlib import MatplotlibDeprecationWarning as mDeprecation +from matplotlib import MatplotlibDeprecationWarning as mplDeprecation warnings.warn( "matplotlib.mpl is deprecated and will be removed in the next release." - "Please use `import matplotlib as mpl` instead", mDeprecation) + "Please use `import matplotlib as mpl` instead", mplDeprecation) from matplotlib import artist from matplotlib import axis from matplotlib import axes From 088677c4c386ff7be6fb3d04f6068b88ce089131 Mon Sep 17 00:00:00 2001 From: Damon McDougall Date: Wed, 16 Jan 2013 13:58:49 -0600 Subject: [PATCH 5/5] Add more verbose removal warning stating version --- CHANGELOG | 1 - lib/matplotlib/mpl.py | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e74287530db1..b341d5191cee 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,7 +30,6 @@ color so that any alpha set by markerfacecolor will respected. - Thomas Caswell ->>>>>>> deprecate undocumented `matplotlib/mpl.py` 2012-11-13 Add a symmetric log normalization class to colors.py. Also added some tests for the normalization class. Till Stensitzki diff --git a/lib/matplotlib/mpl.py b/lib/matplotlib/mpl.py index 969a0dc4b380..51e8a3204b73 100644 --- a/lib/matplotlib/mpl.py +++ b/lib/matplotlib/mpl.py @@ -1,7 +1,10 @@ +""" +.. note:: Deprecated in 1.3 +""" import warnings from matplotlib import MatplotlibDeprecationWarning as mplDeprecation warnings.warn( - "matplotlib.mpl is deprecated and will be removed in the next release." + "matplotlib.mpl is deprecated and will be removed in version 1.4." "Please use `import matplotlib as mpl` instead", mplDeprecation) from matplotlib import artist from matplotlib import axis