Deep reload for `%run` #461

jedbrown opened this Issue May 22, 2011 · 11 comments

9 participants


Suppose I'm editing and testing it using %run which contains import themod. I am not aware of any current mechanism to make %run automatically reload themod when it has changed, but this would be an extremely useful feature.

IPython member

That makes sense, although I'm not sure how easy it would be to implement. It probably won't be sorted before 0.11, though.


Though 2 years has gone, 0.13.1 still hasn't deep reload for %run yet.

IPython member

I guess no-one has felt the need strongly enough to implement it. It should be possible with autoreload, if you'd like to have a go.


For what is worth, Spyder has had this functionality for a very long time. It deletes from the current namespace and then reloads all local modules used on a given script before re-running it.


@ccordoba12 where is the source code of the functionality in Spyder, Thanks.


@Honghe, you can find it here. runfile is our version of %run, and UserModuleDeleter is the class in charge of reloading local modules.

For the future we are considering to replace %run with runfile for kernels managed by us.


This would be extremely useful for me, means i only need one interpreter for everything! Would be great if it was just an option to the run command e.g. run -dr


+1 for this feature request


If I know what is the problem hindering development of this I will gladly work on it, currently with '%autoreload 2' I get TypeError('super(type, obj): obj must be an instance or subtype of type)' any time I change a class that has a call to super. The solution could be a new %run2 comamnd that has a combination of [this answer](] and Spyder's.
Here is another reload mechanism that takes care of old instances too:

@blokeley blokeley added a commit to blokeley/dotfiles that referenced this issue Feb 11, 2016
@blokeley blokeley Create ec88d66
kawing-chiu commented May 6, 2016 edited

+1 for this. This issue renders autoreload useless for projects with just moderate inheritance complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment