Re:PEP 704 – Require virtual environments by default for pac...
by milliams on Wednesday March 15, 2023 @09:01AM
(#35167670)
There is not an actual need to activate for most use cases. I almost always just do
[ Parent
| on HN ]
Re:PEP 704 – Require virtual environments by default for pac...
by nerdponx on Wednesday March 15, 2023 @09:24AM
(#35167978)
This is what I do in 99% of my projects. Or I use a tool like Hatch that creates envs for me, and I can use `hatch run ...` instead of manually invoking the path.
People like to complain about Python, but `./venv/bin/foo` is basically identical to `./node_modules/.bin/foo` and I don't see why the former deserves so much hate.
Re:PEP 704 – Require virtual environments by default for pac...
by gymbeaux on Wednesday March 15, 2023 @09:54AM
(#35168361)
I think it's because you "have to" run a command to activate the virtual environment AKA use files that are already in the directory. With NodeJS (or any other platform/language), it's implied that the files in your current directory are the files you want to use for building/execution
Re:PEP 704 – Require virtual environments by default for pac...
by twic on Wednesday March 15, 2023 @10:20AM
(#35168690)
Explicit is better than implicit, after all.
Re:PEP 704 – Require virtual environments by default for pac...
by tomjakubowski on Wednesday March 15, 2023 @04:53PM
(#35174561)
Just to give an example where activate is needed, if you have the tool programs `a` and `b` installed in the venv, and `a` invokes `b` (invokes as opposed to importing python modules), then:
.venv/bin/a
wouldn't be able to invoke b without activating the venv or otherwise putting .venv/bin on the PATH.