Julian / venvs

venvs creates virtualenvs
https://pypi.org/project/venvs/
MIT License
17 stars 12 forks source link

Teach mkenv to bootstrap itself into a virtualenv #6

Open Julian opened 7 years ago

altendky commented 6 years ago

I completely agree that it needs to be easy to install. Either a bootstrap or it makes itself safe to pip install --user which I think just means vendoring all apps. But, blech. I'm thinking a 2/3 compatible script that tries each of virtualenv, python2 -m virtualenv, python3 -m virtualenv, and python3 -m venv (and the Windows py incantations etc) to try to find a way to create an env to install into.

Should this first env be temporary and then run that mkenv to install another copy of mkenv to a permanent mkenv-managed spot? That's how the triforce thing i've been using suggests. I don't know if there would be issues self-updating after that on Windows though. Though I guess you get around that with pip simply by doing python -m pip, so presumably the same thing would work for mkenv to update itself.

Just had a thought though, if we create a zipapp with vendored deps including virtualenv that could itself be the bootstrap and it could directly create the permanent mkenv-managed mkenv. Instead of rewriting a python-finder we could use an existing one. I touched on sarugaku/pythonfinder when I was working on pipenv a few weeks ago. It needs work but could be useful. I'm not clear if PEX would be relevant or not. Haven't dug enough to figure out if it requires PEX to be installed only for creation of the 'zip' or for running it as well.

altendky commented 6 years ago

PEX doesn't explicitly support windows and apparently tries to include python with the zip. I think I'd rather stick with just a pure-Python-source zipapp for now. I've got a start at that (not pushed anywhere). The expectation would be that it would be able to run with any python which mkenv supports. Perhaps we should add a 'bootstrap' command to mkenv itself rather than making it a special thing only accessible by the zipapp? Then you could run mkenv however you wanted from the zipapp but you could also easily bootstrap such as mypython mkenv.pyz --bootstrap. Presently we have separate entry points for various activities but after #29 the zipapp could give access to everything.