Running Virtualenv with a custom distlib?

Paul Moore p.f.moore at gmail.com
Mon Jan 16 11:44:37 EST 2017


On Friday, 13 January 2017 09:27:59 UTC, haraldn... at gmail.com  wrote:
> I want to do some development on `distlib`, and in the process run the code via `virtualenv` which has distlib as a dependency.
> 
> That is, not run the process inside a virtualenv, but run virtualenv's code using a custom dependency. What are the steps I need to go through to achieve this?
> 
> It seems to me that normal package management (`pip`) is not possible here.

virtualenv bundles a local copy of pip. And that pip in turn vendors distlib. So you'd need to build a new pip wheel with your customised version of distlib vendored in it, and then build virtualenv with that version of pip embedded.

(You can avoid the last step by putting the new pip wheel in a virtualenv_embedded directory next to virtualenv.py, but you'd have to check the docs and maybe sources to ensure I remembered that right. Also your pip wheel would need to be a higher version than the embedded one, or it would get ignored).

Paul


More information about the Python-list mailing list