Switching to pew from virtualenvwrapper

  |   Source

Wanted to try something new so I switched from using virtualenvwrapper to Python Env Wrapper, aka pew for my Python virtual environments.

The cleanup.

(This is an ArchLinux system.)

Remove the python entry from the .zpreztorc file (which setup the WORKON_HOME env variable).

Then, remove virtualenvwrapper from the system:

yaourt -Rns python-virtualenvwrapper

then rebooted to MAKE SURE the environment came up clean.

The install and setup.

Installed pew:

yaourt -S python-pew

Since I am using Nikola to create this website, I:

pew new valencering

This created the new virtualenv, launched a new sub-shell and added the text "valencering" to the left side of the prompt but it didn't set the project directory.

So I cd'd to the working directory and ran:

pip install --upgrade "Nikola[extras]"

and then ran nikola build.

And it worked.

I exited the sub-shell and the prompt changed back to "normal" and nikola was no longer a valid command.

I then ran

pew workon valencering

It set the virtualenv but didn't take me to the code. So again, I cd'd there manually.

With the virtualenv activated and in the "home" directory I ran:

pew setproject

Now, no matter where I am, if I run:

pew workon valencering

it will take me to the code and set the virtualenv just like virtualenvwrapper would do.

Additional Information.

Looking at the Command Reference, I could have done all this in one command:

cd to the working directory

pew new -a $PWD valencering

One other difference is that the default location for the virtual environments is now at ~/.local/share/virtualenvs, whereas before, both oh-my-zsh and prezto set it at ~/.virtualenvs but it could be overridden with environment settings.

Comments powered by Disqus