new MatplotlibDeprecationWarning class #1565

Closed
wants to merge 1 commit into
from

Projects

None yet

6 participants

@ivanov
Member
ivanov commented Dec 5, 2012

In light of the fact that Python builtin DeprecationWarnings are ignored
by default as of Python 2.7 (see link below), this class was put in to
allow for the signaling of deprecation, but via UserWarnings which are
not ignored by default.

http://docs.python.org/dev/whatsnew/2.7.html#the-future-for-python-2-x

Prior to this commit:

In [1]: %pylab

Welcome to pylab, a matplotlib-based Python environment [backend: agg].
For more information, type 'help(pylab)'.

In [2]: mlab.liaupunov([1,2], np.diff)
Out[2]: 0.0

After this commit:

In [1]: %pylab

Welcome to pylab, a matplotlib-based Python environment [backend: agg].
For more information, type 'help(pylab)'.

In [2]: mlab.liaupunov([1,2], np.diff)
/home/pi/.local/lib/python2.7/site-packages/matplotlib/mlab.py:1212:
MatplotlibDeprecationWarning: This does not belong in matplotlib and
will be removed
  mDeprecation) # 2009/06/13
Out[2]: 0.0

this was motivated by the discussion over in #1535

@ivanov ivanov new MatplotlibDeprecationWarning class
In light of the fact that Python builtin DeprecationWarnings are ignored
by default as of Python 2.7 (see link below), this class was put in to
allow for the signaling of deprecation, but via UserWarnings which are
not ignored by default.

http://docs.python.org/dev/whatsnew/2.7.html#the-future-for-python-2-x

Prior to this commit:

```
In [1]: %pylab

Welcome to pylab, a matplotlib-based Python environment [backend: agg].
For more information, type 'help(pylab)'.

In [2]: mlab.liaupunov([1,2], np.diff)
Out[2]: 0.0
```

After this commit:
```
In [1]: %pylab

Welcome to pylab, a matplotlib-based Python environment [backend: agg].
For more information, type 'help(pylab)'.

In [2]: mlab.liaupunov([1,2], np.diff)
/home/pi/.local/lib/python2.7/site-packages/matplotlib/mlab.py:1212:
MatplotlibDeprecationWarning: This does not belong in matplotlib and
will be removed
  mDeprecation) # 2009/06/13
Out[2]: 0.0
```
164fa0a
@pelson pelson commented on the diff Dec 6, 2012
lib/matplotlib/axes.py
@@ -3135,12 +3135,12 @@ def connect(self, s, func):
disconnect to disconnect from the axes event
"""
- raise DeprecationWarning('use the callbacks CallbackRegistry instance '
+ raise mDeprecation('use the callbacks CallbackRegistry instance '
'instead')
@pelson
pelson Dec 6, 2012 Member

Indentation on all of these is now squiffy. Would you mind de-denting the continued lines throughout?

@efiring
efiring Dec 6, 2012 Member

Specifically, de-denting to align the starting single quotes--I hope that is what you mean, @pelson.

@dmcdougall
dmcdougall Dec 6, 2012 Member

On Thu, Dec 6, 2012 at 11:39 AM, Eric Firing notifications@github.comwrote:

Specifically, de-denting to align the starting single quotes--I hope that
is what you mean, @pelson https://github.com/pelson.

+1

Damon McDougall
http://www.damon-is-a-geek.com
Institute for Computational Engineering Sciences
201 E. 24th St.
Stop C0200
The University of Texas at Austin
Austin, TX 78712-1229

@pelson
pelson Dec 7, 2012 Member

Yep 😄

@pelson
Member
pelson commented Dec 6, 2012

Is this a good time to go through and remove everything that we said we would remove. There are quite a few old deprecations which we can now just remove.

@WeatherGod
Member

Let's make that a separate task

@mdboom
Member
mdboom commented Dec 6, 2012

Yes -- but if many people have not been seeing this DeprecationWarnings (because they were on Python 2.7 and didn't turn on all warnings) is it right to pull the features before adequate warning? Maybe we put this PR on 1.2.x, we plan on a 1.2.1 for certain, and then we remove things on master?

@WeatherGod
Member

I would be amendable to that idea.

@dmcdougall
Member

@mdboom That's just as well, since this will lead to merge conflicts due to the recent PEP8 changes on the axes module.

Instead of rebasing, how about we just create a new PR targeting 1.2.x?

@mdboom
Member
mdboom commented Dec 7, 2012

A new PR would probably be best -- it's cleaner than the backporting we sometimes do.

@dmcdougall
Member

Agreed.

@ivanov Would you be able to do that?

@ivanov ivanov closed this Dec 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment