[Python-ideas] Sharing modules across virtualenvs

Phyks phyks at phyks.me
Fri Feb 12 05:00:53 EST 2016


Hi,

I was wondering recently about the way virtualenvs work, and did not
find much information on the design choices. Sorry if this is not the
right mailing-list to post about it, but it seemed to be.

As far as I understand, virtualenvs work by modifying the PYTHONHOME and
then the folders in which to look up to import modules.

Are there any specific reasons for this implementation, and not a
"/lib"-like implementation, putting the various versions of the module
in a single folder, with a version naming, and symlinking the up-to-date
one?

Then, virtualenvs could simply be applied as filters on this specific
folder, to hide part of the available module. Contrary to the current
implementation, this means building (and storing, although storage is
said to be cheap) large Python modules only once for your system, and
share them.

I do not doubt there were great reasons to choose to move the lookup
path, however. But I do not know which one they are.

Thanks!
-- 
Phyks


More information about the Python-ideas mailing list