[IPython-dev] [EXTERNAL] rant: "%matplotlib inline"

MinRK benjaminrk at gmail.com
Mon Jul 6 15:17:02 EDT 2015


On Mon, Jul 6, 2015 at 10:03 AM, Thomas Kluyver <takowl at gmail.com> wrote:

> On 6 July 2015 at 09:37, MinRK <benjaminrk at gmail.com> wrote:
>
>> I think it should be IPython's responsibility to detect matplotlib's
>> import and register the inline backend.
>
>
> This seems reasonable, but looking at the docs, I realise I'm not actually
> sure how to register a hook to fire after an import. There's plenty of
> machinery for intercepting imports to provide a module in some other way,
> but nothing obvious for detecting that an import has happened. PEP 369,
> post import hooks, was withdrawn years ago.
>
> I guess we'd need to override __import__(), but that feels rather wrong.
>

I think we can still accomplish this with a regular import hook (I already
have
<https://github.com/minrk/profile_default/blob/master/startup/mplimporthook.py>,
I just doubt the module checking is appropriately rigorous for inclusion in
IPython).

-MinRK


>
>
> Thomas
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150706/24107b61/attachment.html>


More information about the IPython-dev mailing list