[Distutils] Reliable means in site.py to reinitialize sys.path?

Ron DuPlain ron.duplain at gmail.com
Sun Sep 2 02:50:15 CEST 2012


Hello,

Does site.py provide a reliable means to reinitialize sys.path of a
running process?

I see that Python 2.7 added site.getsitepackages() which gives the
paths needed to reinitialize explicitly, but it appears that
virtualenv's site.py does not include this change.
https://github.com/pypa/virtualenv/blob/5b904f88583d40954701c5471527fc07c7ae9056/virtualenv_embedded/site.py

To give some context, I'm interested in code reloading inside
virtualenvs on production systems where I would like to reduce
downtime to 0. Packages installed as non-zip eggs are added to a .pth
file, and attempts to reload(module) or even __import__ in a child
process do not get the new code since sys.path is still pointing at
the old paths given at the time the .pth file was read.

Thanks,

Ron


More information about the Distutils-SIG mailing list