sashahart / vex

Run a command in the named virtualenv.
MIT License
372 stars 26 forks source link

Use python -m venv #54

Closed jobevers closed 5 years ago

jobevers commented 7 years ago

For python3, virtualenvs should be created using python -m venv https://docs.python.org/3/library/venv.html#creating-virtual-environments

But in https://github.com/sashahart/vex/blob/b7680c40897b8cbe6aae55ec9812b4fb11738192/vex/make.py#L46 the command is set to use virtualenv. It would be nice to detect if there is a venv module available and use that instead of the virtualenv command

brianbruggeman commented 6 years ago

To add to this, something isn't right here...

$  python3 -m venv $WORKON_HOME/venv-vs-vex
$  vex venv-vs-vex
Error: path '$WORKON_HOME/venv-vs-vex' did not look like a virtualenv

They should be 100% compatible.

rsyring commented 6 years ago

@brianbruggeman it works for me if I use -m virtualenv:

rsyring@loftey:~$ python3 -m virtualenv $WORKON_HOME/venv-vs-vex
Using base prefix '/usr'
New python executable in /data/tmp/virtualenvs/venv-vs-vex/bin/python3
Also creating executable in /data/tmp/virtualenvs/venv-vs-vex/bin/python
Installing setuptools, pip, wheel...done.
rsyring@loftey:~$ vex venv-vs-vex 
(venv-vs-vex)rsyring@loftey:~$ 
brianbruggeman commented 6 years ago

@rsyring venv is now part of the standard library in python3. While I accept that there is a work-around, I think that vex should work with the standard library version.

sashahart commented 5 years ago

"virtualenvs should be created using python -m venv"

Why "should"?

Do not just phrase your desires as "should." Explain the actual justification.

brianbruggeman commented 5 years ago

At this point, I've left vex and created my own tool that does what I want it to do because it's really obvious we disagree on direction and I am not going to waste my time arguing with someone that's not interested in new ideas.

sashahart commented 5 years ago

@brianbruggeman you have nothing to do with this issue, please don't post on my issues irrelevantly to advertise your projects

sukiletxe commented 5 years ago

Can I give it a go, as I'm currently interested in this too (I know it's been closed, but I can see it hasn't been closed by the author)

In an otherwise empty virtualenv, venv more or less halves the space consumed by virtualenv (after adding wheel too, as virtualenv does). Also, it takes less time to install a virtualenv with venv than with virtualenv (without adding wheel this time, as I don't know how to time that in Windows). This is because venv only copies some scripts, creates an empty lib/site-packages directory and creates a cfg file pointing to the main python, enabling the use of the main stdlib without copying it over. So, less time to create and less space per virtualenv (~10 MiB).

Problem: I don't know how venv has changed from Python 3.3 to 3.7, or how the pyvenv module worked before being deprecated and droped.

Note: The second comment is incorrect now. If I do vex test-venv cmd after py -3 venv it works just fine.