[IPython-User] Getting deepreload to work by default

David Prager Branner brannerchinese@gmail....
Wed Aug 28 12:41:38 CDT 2013

Thanks. Here's a minimum working example

Contents of ~/.ipython/profile_default/startup/ipython3_startup.ipy:

    %load_ext autoreload
    %autoreload 2

Created file `simple.py`:

    def main():
        print('Single line of

Within Ipython 1.0.0 (Python 3.3.1, Mac OS 10.8.4)

    In [1]: import simple as S

    In [2]: S.main()
    Single line of output

    In [3]: # to simple.py now add this line and save: print('Added line')

    In [4]: S.main()
    Single line of output

So it appears that S is not reloading, since the added line is not printing.

This is not as expected, correct? I'll delete my virtualenv and reinstall,
but before I do, is there any sort of test I can run to see if something
fundamental is wrong with my installation?

Many thanks. Ipython is a really superb tool, you know.

- dpb

Developer and Lexicographer of Chinese

On Tue, Aug 27, 2013 at 12:41 PM, Thomas Kluyver <takowl@gmail.com> wrote:

> On 27 August 2013 02:13, David Prager Branner <brannerchinese@gmail.com>wrote:
>> The API currently describes the use of deepreload as follows:
>>> import __builtin__, deepreload
>>> Those instructions are written for Python 2. There are two differences
> in Python 3: __builtin__ got renamed to builtins (with an s, without the
> underscores), and the reload function got moved out of the builtins to the
> imp module. For interactive use, you should be able to just do 'from
> IPython.lib.deepreload import reload'.
> > But I don't find that deep reloading is in fact taking place
> automatically, even though
> >
> > %load_ext autoreload
> > %autoreload 2
> It shouldn't be necessary to combine deepreload and autoreload - with
> autoreload 2 on, it should check all imported modules, unless you've
> excluded any with %aimport -foo. If it's not doing that, there's presumably
> a bug somewhere.
> Thanks,
> Thomas
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130828/a8b1ec8f/attachment.html 

More information about the IPython-User mailing list