Project organization and import

Dave Baum Dave.Baum at
Mon Mar 5 21:02:28 CET 2007

In article <1173119492.198000.252500 at>,
 "Martin Unsal" <martinunsal at> wrote:

> That too... although I think that's unfortunate. If reload() were
> reliable, would you use it? Do you think it's inherently unreliable,
> that is, it couldn't be fixed without fundamentally breaking the
> Python language core?

I wrote a module that wraps __import__ and tracks the dependencies of 
imports.  It then allows you to unload any modules whose source have
changed.  That seemed to work out nicely for multi-module projects.

However, one problem I ran into was that dynamic libraries don't get
reloaded, so if you are doing hybrid C++/Python development then this
doesn't help - you still have to restart the whole python process to
pick up changes in your C++ code.

I also didn't do a ton of testing.  It worked for a few small projects
I was working on, but I stopped using it once I ran into the dynamic
library thing, and at this point I'm used to just restarting python
each time.  I'm sure there are some odd things that some python modules
could do that would interfere with the automatic reloading code I

If you're interested in the code, drop me an email.


More information about the Python-list mailing list