you are viewing a single comment's thread
view the rest of the comments
[–] 14 points 3 years ago* (last edited 3 years ago) (3 children)

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.

  • source
  • hideshow 6 child comments
  • [–] 1 point 3 years ago (1 child)

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

  • source
  • parent
  • hideshow 2 child comments
  • [+] 1 point 3 years ago (3 children)
  • [–] 2 points 3 years ago

    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.

  • source
  • parent
  • [–] 1 point 3 years ago (1 child)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [+] 1 point 3 years ago (1 child)
  • [–] 1 point 3 years ago

    I only use python as a go-to scripting language when I need to quickly automate something or write a quick throwaway script that requires an SDK, since there's a python library for almost anything and doing it in powershell would be too much aditional work. But it does make sense that for CI you only need to figure out the venv setup once and you're done, so it may be a better solution.

  • source
  • parent