You are viewing a single thread.
View all comments
14 points
*

My workflow:

cd project
python -m venv .venv
. ./.venv/bin/activate
pip install -e .

By default pyvenv excludes system packages, so I can have different versions in the venv. To reset the venv, I just have to delete the .venv dir.

permalink
report
reply
1 point

Seconded, after being burned repeatedly I always do this. But why are you calling activate from the directory above?

permalink
report
parent
reply
4 points

I don’t think he does. If you’re talking about the third line, there’s a space between the dots.

The dot command is equivalent to source (running the script in the context of the current shell).

permalink
report
parent
reply
1 point

I’ve been using pipenv for a good while but I’ve started to move over to venv slowly, and I like it so far. It’s a bit more of manual work but I feel like it’s worth it.

permalink
report
parent
reply
2 points

i’ve moved to just using conda environments. i find it’s a lighter load on my old brain.

permalink
report
parent
reply
2 points

I love this workflow because it has only two prerequisites: python and pip. It works on windows, linux, any vm or container. Pipenv requires some setup, while this should work everywhere. In powershell you have to use ./.venv/bin/acticate.ps1 but that’s the only difference.

permalink
report
parent
reply
1 point

What did you not like on pipenv in comparison to venv? I was always avoiding venv because it was, as you said, manual work and it was too much effort to again google what was the order of commands and parameters to start a venv, which is not an issue in pipenv, since you just pipenv install what you need.

permalink
report
parent
reply
1 point

We had some issues in our CI where pipenv would sometimes fail to sync. It has recently gotten better, I think due to a fix of some race condition due to parallel installation. I think venv would be better suited for CI in general, since it allows the use of a simple requirements.txt file.

The other thing is I think it is rather slow, at least on windows which most of my team uses.

To conclude, I think as long as you aren’t having any trouble and it simplifies your environment, you might as well use it.

permalink
report
parent
reply
1 point

Exactly, venv solves this issues for me

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 3.4K

    Monthly active users

  • 1K

    Posts

  • 38K

    Comments