tusharsadhwani / yen

The last Python environment manager you'll ever need.
MIT License
137 stars 9 forks source link

notes: speeding up venv creation #24

Open tusharsadhwani opened 1 week ago

tusharsadhwani commented 1 week ago

I don't like it when venv creation takes 2 seconds. Especially since I know it can be faster.

virtualenv would be the prime example, which is super fast by default.

I added microvenv which was super simple, but the problem with microvenv is that we have to run python -m ensurepip after which is really slow.

I looked at micropip from pyodide, and installer from pypa, and both don't fit our usecase.

So realistically, I'll have to figure out how virutalenv does it this fast. I have my ideas, such as it may just be copying or symlinking some stuff to get pip.

tusharsadhwani commented 1 week ago

virtualenv is infact just caching the pip wheel's contents in a directory.

$ cd /Users/tusharsadhwani/Library/Application\ Support/virtualenv

$ ls
py_info wheel

$ ls wheel/3.12/image/1/CopyPipInstall/pip-24.0-py3-none-any/pip/
__init__.py     __pip-runner__.py   _vendor
__main__.py     _internal       py.typed