I'm trying to understand when is best to use mkproject
vs mkvirtualenv
when using virtualenvwrapper
.
I found a couple of answers of what is the difference between the two here and here.
From the second link, this seems to be the best summary of the differences:
From my understanding of the documentation,
mkvirtualenv projectenv
simply creates a new virtual environment namedprojectenv
in$WORKON_HOME
, whilemkproject projectenv
creates a new virtual environment namedprojectenv
and a new directory namedprojectenv
; after creation, theprojectenv
directory automatically becomes your current working directory. The virtual environment will exist in$WORKON_HOME
and the development directory exists in$PROJECT_HOME
.
When would it be more appropriate to use mkproject
and when mkvirtualenv
? I would really find an example of the differences useful if possible.
mkvirtualenv
creates (and activates) just a virtualenv — a python environment that separates libraries from globally installed to prevent your development from messing with system libraries.
mkproject
creates (and activates) a virtualenv and a new empty directory in which you will do your development.
If you already done some development and have a directory with source code you still can make it a project: create or activate a virtualenv, change directory to the source code directory and run setvirtualenvproject
.
The only advantage of marking a source code directory being a project is that when you activate the environment virtualenvwrapper
automatically change directory to the source code directory. And you can do it from the command line with command cdproject
.