-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate mpl.py (was Remove mpl.py) #1535
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
I'm fine with this. However, I didn't even know Does anybody else have any feedback? |
Yeah -- I wasn't aware of this either. I think |
I thought maybe I was the one who introduced mpl.py, but it looks like it was John, back in 2007. I don't recall the rationale. I use it in quite a few places in my own code. I don't mind changing my own code to accomodate its removal--I can do it easily, and will do so in any case--but I do wonder whether some other misguided soul might be using it, and might be puzzled by its disappearance with no deprecation process. After all, it is a whole module, even though it is undocumented and trivial in its content. (It might have been introduced so that one could import core matplotlib modules without importing the legacy numerix module. I haven't tried to diagnose whether that is actually its effect. It is part of a changeset that was phasing out numerix. I was quite involved in all the comings and goings with numerix, Numeric, numarray, numpy, and the variations of masked arrays.) |
@efiring Maybe add a warning just to be careful? |
Yes, I think the way to remove mpl.py is by starting with a deprecation warning. |
I agree. That will save us a lot of mailing list traffic if a lot of people are using it. @ivanov Shall I close this PR in favour of a deprecation, or would you just like to update and rebase this one? |
I'll update and rebase in a couple of hours, that does sound like a more |
`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.
ok, I've added the deprecation warning. The only caveat now is that as of Python 2.7, DeprecationWarnings are ignored by default, and the flag to enable them (
|
@ivanov Awesome. Thanks. Regarding the
Should we add a |
@dmcdougall thanks for that link, it seems the decision to silence Here are a few options that I see, will seek broader feedback on mpl-devel list:
I don't think we want to turn on
This seems a bit inelegant, and does not solve our otherwise silenced DeperecationWarning`s in other places, there are about 40 others right now.
This gets all of matplotlib's I think, overall, we should not be in the business of taking control away form the user - I'd be annoyed as a user to have to disable something matplotlib did on my behalf, especially when default python mechanisms for disabling or enabling warnings from the command line would be ignored after this.
|
I agree with the suggestion to move to |
@ivanov The deprecations PR was merged, so this will need rebasing. However, before you do rebase it, we should think about when this should be deprecated. If we deprecate now (as in, for a 1.2.1 release), we run the risk of the deprecation not getting enough visibility if 1.3 rolls around quicker than expected. If we deprecate in 1.3 (which is what this PR is doing currently), mpl.py won't be removed until 1.4/2.0, and that might be a while. There's no 'correct' approach here, just two different ones with different outcomes. I have never used mpl.py, so I'm not sure I have the necessary experience to give an objective suggestion. |
Ok, thanks for the reminder to rebase. I don't see a reason to rush with removing this, even if we deprecate in 1.2.1, we probably shouldn't remove until 1.4 - I just wanted to see this go the way of the dodo at some point, and this will be a first important step toward that. |
Actually, come to think of it, 1.2.1 is a bugfix release. Deprecating mpl.py doesn't fix a bug, so I think master is more appropriate, which is what you've done here. |
oh yeah, I think I also had that thinking to begin with... |
@ivanov, It looks like this unfortunately needs rebasing, after which it can be merged. I don't quite understand the bit about finance, but I trust you do and have handled it correctly. |
Just a tiny nitpick: could you add the version of matplotlib when the removal of mpl will take place? I find this very useful both for users and developpers (the latter then being able to |
@NelleV Where do you think it should go? In the warning message? |
@dmcdougall Yes, this way the users see it. Numpydoc also recommands adding it to the docstring as the following example:
|
In the interest of getting this merged, I'm going to fork this branch to address @NelleV's concerns. |
See #1670. |
Resolved in #1670. |
matplotlib/mpl.py
is a file which gets imported via ipython's%pyplot
interface as module namedmpl
, yet it isn't clear at all what it's role is (it has no docstring).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 thempl
name within matplotlib not be thematplotlib
module itself.This module was only used in thepylab
interface, where it was simply imported in one line viafrom matplotlib import mpl
and never used again. This PR changes that one line to beimport matplotlib as mpl
and removesmatplotlib/mpl.py
altogetherThe only thingmpl.py
that doesn't get imported if, inpylab.py
, we changefrom matplotlib import mpl
toand get rid ofmpl.py
altogether, is thefrom matplotlib import finance
. I have added a commit here to retain that import, just in case. Howver, I'm not sure it's the right thing to do, because now it preserve a bit of a dichotomy betweenimport matplotlib as mpl
andfrom pylab import mpl
, where the latter will havempl.finance
, and the former will not.I'm open to removing 4863826 from this PR in order to not squelch this dichotomy, and document such potential backwards incompatibility instead.UPDATED: switched to deprecation of mpl.py
matplotlib/mpl.py
is a file which used to get imported via ipython's%pyplot
interface as module namedmpl
, yet it isn't clear at allwhat 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 tohave something with the
mpl
name within matplotlib not be thematplotlib
module itself.This module was only used in
pylab
interface, where it was simplyimported in one line via
from matplotlib import mpl
and never usedagain. 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.