Ha. I always thought something was unnecessarily awkward about virtualenv, but I couldn't quite put my finger on it. Virtualenvwrapper was an improvement in many ways, but its lack of portability could be a pain. Reading the docs, Vex makes perfect sense. We should use virtualenv basically the same way we sudo. It's kind of amazing it took this long for someone to do it. Thanks!
Vex seems very convenient, but it is also possible to avoid the "magic" with just standard virtualenv. If you provide the full path to the python binary in the virtualenv, it executes with the virtualenv loaded: /home/acjohnson/virtualenvs/foo/bin/python myscript.py This is useful for crontabs, system service config, etc. which don't load a regular user's bash setup files.
Show HN: Vex, a new way to run things in Python's virtualenvs
11–20 of 35 posts
Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#12Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#13Just like the author, I never used all virtualenvwrapper's features and was always happy to create and delete VEs on my own. The only thing missing from standard virtualenv workflow is easy way to activate the VE; so I wrote that on my own and been using it since ever. It's trivially small shell script but it does the work well, you can check it out at pypi:
Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#14This is cool, I like tools that focus on one thing. Just like the author, I never used all virtualenvwrapper's features and was always happy to create and delete VEs on my own. The only thing missing from standard virtualenv workflow is easy way to activate the VE; so I wrote that on my own and been using it since ever. It's trivially small shell script but it does the work well, you can check it out at pypi: https:/…
This is also worth checking out if you just want 'workon' type functionality without the fuss.
Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#15Ha. I always thought something was unnecessarily awkward about virtualenv, but I couldn't quite put my finger on it. Virtualenvwrapper was an improvement in many ways, but its lack of portability could be a pain. Reading the docs, Vex makes perfect sense. We should use virtualenv basically the same way we sudo. It's kind of amazing it took this long for someone to do it. Thanks!
Vex seems very convenient, but it is also possible to avoid the "magic" with just standard virtualenv. If you provide the full path to the python binary in the virtualenv, it executes with the virtualenv loaded: /home/acjohnson/virtualenvs/foo/bin/python myscript.py This is useful for crontabs, system service config, etc. which don't load a regular user's bash setup files.
Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#16This looks great. Any way to have a system-wide .vexrc?
Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#17Looks good. I currently use http://tudb.org/articles/2014/03/31/vpython/ for pretty much all of my python projects (also, i am the author of vpython).
Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#18This is based on my personal experience with tools for using virtualenv. virtualenvwrapper is very powerful with all kinds of hooks but I just never used all that power and needed things like speed more. virtualenvwrapper provided a lazy loader but that would have various problems from time to time as you'll see on the issue tracker. So then for a long time I just ran 'virtualenv' and source wherever/bin/activate and…
> pydoc still doesn't work Are you using `pydoc` on the command line? If so, try pdoc: https://github.com/BurntSushi/pdoc . I wrote it as a tool to replace epydoc (strictly automatic documentation), but it works on the command line just like pydoc. (It can also generate HTML documentation with cross module linking that isn't crap. See an example here: http://pdoc.burntsushi.net/nfldb )
However, I still would like to eventually unbreak pydoc for users who might have bad habits like I do.
The issue is that virtualenv itself had an opportunity to fix this (with multiple patches submitted IIRC) and they decided to punt by implementing it as yet another shell function. So for me to unpunt without coupling to the shell, I pretty much have to dump a script into bin/. I guess maybe not that many people use pydoc anyway?
Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#19This is cool, I like tools that focus on one thing. Just like the author, I never used all virtualenvwrapper's features and was always happy to create and delete VEs on my own. The only thing missing from standard virtualenv workflow is easy way to activate the VE; so I wrote that on my own and been using it since ever. It's trivially small shell script but it does the work well, you can check it out at pypi: https:/…
What is truly horrible is that I wrote my shell function, named it ave, thought it was a great name and then months later (edit: after I released vex) realized you had written a package named ave. Oh well.. :) This is also worth checking out if you just want 'workon' type functionality without the fuss.
Re: Show HN: Vex, a new way to run things in Python's virtualenvs
#20This is based on my personal experience with tools for using virtualenv. virtualenvwrapper is very powerful with all kinds of hooks but I just never used all that power and needed things like speed more. virtualenvwrapper provided a lazy loader but that would have various problems from time to time as you'll see on the issue tracker. So then for a long time I just ran 'virtualenv' and source wherever/bin/activate and…
> everyone finds 'workon' invaluable, a position I do understand. At first I wanted to praise virtualfish [1] and its ability to automatically activate a virtualenv when I cd into it, but then I realized that vex's way does indeed make more sense. What do we do in a virtualenv? We basically just run pip to do various things, or run the program (in case it's an application and not a library) or test suite. So yeah, I…
edit: That one feature reminded me of Kenneth Reitz's autoenv (https://github.com/kennethreitz/autoenv).
I can't do anything to futz with cd, but it could be possible to reverse that and cd to a project directory when a virtualenv is activated, I am just not sure yet mechanically the right way to choose which one. Worth considering.