[IPython-User] module reloading in 0.11

Thomas Kluyver takowl@gmail....
Wed Aug 3 04:31:26 CDT 2011


Hi Robert,

On 3 August 2011 09:03, Robert Cimrman <cimrman3@ntc.zcu.cz> wrote:

> In 0.10.2, when one edits a Python script, it is very convenient to try it
> in
> ipython shell using the %run command. But, if a module imported in the
> script
> changes, it is not reloaded, just as the docs say "(except for sharing
> global
> objects such as previously imported modules)".
>
> Could this "problem" be solved somehow by the new two-process architecture
> of
> 0.11? I have just tried the Git version, and it behaves just like 0.10.2 in
> this respect.
>

I don't think the two-process architecture has any effect on it at all - all
your code is loaded and run in the kernel. You can restart the kernel from
the frontend, but then you lose everything in your namespace (like closing
IPython and starting it again).

Have a look at the code in IPython.lib.deepreload - I think it should be
possible to tweak the %run magic so that it replaces the
__builtin__.__import__ function before running code, and puts it back
afterwards.

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20110803/e0c084d7/attachment-0001.html 


More information about the IPython-User mailing list