Hacker News new | ask | show | jobs
by hwgern 654 days ago
I agree with most of your "Environment as Code" post. Virtual environments are overhyped and even experienced developers frequently have to fix their venv or repair their conda install. You get to depend on a tool that's not necessary and distracts from the original purpose of using the software.

On Unix, it is even trivial to have parallel installations.

Build two pythons:

  ./configure --prefix=/home/foo/a && make && make install
  make distclean
  ./configure --prefix=/home/foo/b && make && make install
Install packages:

  /home/foo/a/bin/python -m pip install bar
  /home/foo/b/bin/python -m pip install quux
This is completely isolated. You can do the same by using the Windows installer to install to different directories. If an installation breaks, remove it and reinstall.

My experience is that people who recommend various environment software often like strict bureaucratic procedures, or have a financial interest in pushing the software or are simply not experienced and do what they are told.

1 comments

I agree. It would be better if people understood the costs and benefits of virtual environments and used costs and benefits to guide decisions about how and when to use them.

The general observation I would add is that these change with the level of experience of the person writing the code. I found it helpful and harmless to avoid them when I was experimenting. Now, I use them automatically.

I know that it made people angry, but I think it was reasonable to say that if someone does not know how to edit a file and is not comfortable using the terminal, they are not ready for virtual environments.

Re separation, another option is the one I recommend in the "Environment as Code" post: Right now, I'd suggest installing

- Python3.12

- Python3.11

- Python3.10

Then use edits to `.zprofile` to specify which will be used in any terminal session. It does require the use of an editor to make changes to `.zprofile`, which is where the official versions put the lines that add things to the user PATH. I think it is very helpful to get people familiar with how profiles set PATH for any terminal session and how easy it is to control by commenting out or commenting back in lines in `.zprofile`.

Later, one can introduce them to `.zshrc`.