Live data from Hacker News

Use pew, not virtualenvwrapper, for Python virtualenvs

planspace.org

41–50 of 57 posts

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#41
post #6

As someone who is finally getting into Python development (via Django) after following tons of tutorials over several years: should I be using pew, virtualenvwrapper, or something else? This article is from 2015, how relevant is it today?

It doesn't matter much, it's all just sugar over virtualenvs (which are quite simple conceptually). Virtualenvwrapper has been around a long time and works pretty well.

More recent tools are Pipenv (which I've been using) and hatch - I don't think there is any One True Way since the days of virtualenvwrapper being the latest and shiniest.

If you want a really easy to use tool that doesn't require any understanding of virtualenvs, I'd look at Pipenv.

http://docs.pipenv.org/en/latest/

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#42
post #5
post #3

Earlier quoted context omitted.

There's a link in the article which explains why https://gist.github.com/datagrok/2199506

So basically I could start up another shell with that as a launching command and it'd be straight back to being "appropriately unixy"

Yes. I do it with six lines of shell script: https://is.gd/bsNBve.

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#43
post #36

The discussion here has quickly gotten out of hand and at the risk of causing more confusion I would like to point out that pipenv( http://docs.pipenv.org/en/latest/ ) seems to be the officially recommended Python packaging tool now[1], though venv and pip work too. [1] -- ( https://packaging.python.org/new-tutorials/installing-and-us... )

We are talking about packaging tools now?

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#45
post #43
post #36

The discussion here has quickly gotten out of hand and at the risk of causing more confusion I would like to point out that pipenv( http://docs.pipenv.org/en/latest/ ) seems to be the officially recommended Python packaging tool now[1], though venv and pip work too. [1] -- ( https://packaging.python.org/new-tutorials/installing-and-us... )

We are talking about packaging tools now?

Kindly don't shoot the messenger(i.e. me) but pipenv does the work of pip + virtualenv + requirements.txt so packaging tool seems like a good name for it. Virtual environments aren't a lot of fun without local packages and reproducibility I assume.

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#46

I'll take a chance to plug `vrun` https://pypi.org/project/vrun/ here as well which is a very lightweight wrapper around activate that only applies to the current command. You can use it to start a subshell if you wish. The fundamental problem is that virtualenv scripts are not actually bound to their actual virtualenv. If you forget to activate and a script shells out in a subprocess to execute another script it wil…

When you get a chance, try out Hatch and its `use` command i.e. `hatch use myenv pip install ...`

https://github.com/ofek/hatch/blob/master/COMMANDS.rst#use

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#47
post #28

Earlier quoted context omitted.

Nope it's been virtualenv for at least 3 years.

I've used it continuously for 6 years.

Yeah I've done so for three - I'm happy enough with it and confident enough to recommend it that I didn't bother to look up how long it's been around for..

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#48
post #15
post #4

Why not use conda?

Because conda (and by extension, Anaconda) harms the Python ecosystem with their non-standard package format. If Continuum Analytics cared about making scientific packages like numpy and scipy more accessible, they would make binary wheels for Linux/Windows/OSX with the MKL. There is no technical reason that prevents them from doing this. Instead they lock you in to their package/environment manager and create confus…

Conda is a package manager for more than Python. It manages libraries that are shared between Python and R and other tools. This isn't possible with a purely Python-based solution.

It also does envs better than most other solutions since it will prefer hardlinks which allows environmental isolation at a very small cost in terms of disc space.

Full disclosure: I work for Anaconda Inc. where I am trying my best to make package management and scientific computing easier.

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#49
post #11

The preferred environment for Python development and deployment changes more than the latest trend in JavaScript frameworks.

The basic tools (pip and virtualenv) have been the same for years. Posts like this are about layers that people have built on top of the same underlying tools. There's a lot of them, but that's because different people have different preferences, not because those preferences are changing over time. There's no need to chase the latest trend here (if indeed there is a trend).

Re: Use pew, not virtualenvwrapper, for Python virtualenvs

#50
post #22

Earlier quoted context omitted.

Most people I've met use virtualenvwrapper. It doesn't work on other shells like fish though. However, I'd simply focus on learning how virtualenv works, and use whatever tool to manage it as you feel like.

Virtualfish is amazing: https://github.com/adambrenecki/virtualfish

Yeah, it works really well. That is what I use for my fish shell.
Post reply on HN