Live data from Hacker News

Pyenv – lets you easily switch between multiple versions of Python

github.com

51–60 of 341 posts

Re: Pyenv – lets you easily switch between multiple versions of Python

#51

Tools you can use to make sure the Python program you wrote keeps working: requirements.txt, pip, pipenv, pyenv, virtualenv, pyenv-virtualenv, virtualenvwrapper, pyenv-virtualenvwrapper, venv, pyvenv, conda, miniconda, poetry, docker, nix. Which ones did I miss? Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

[deleted]

Re: Pyenv – lets you easily switch between multiple versions of Python

#52

Tools you can use to make sure the Python program you wrote keeps working: requirements.txt, pip, pipenv, pyenv, virtualenv, pyenv-virtualenv, virtualenvwrapper, pyenv-virtualenvwrapper, venv, pyvenv, conda, miniconda, poetry, docker, nix. Which ones did I miss? Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

You missed hatch, uv, rye, pdm.

I think rye hits most of the points pretty well, it ensures both python and package versions.

Re: Pyenv – lets you easily switch between multiple versions of Python

#53
post #46

Tools you can use to make sure the Python program you wrote keeps working: requirements.txt, pip, pipenv, pyenv, virtualenv, pyenv-virtualenv, virtualenvwrapper, pyenv-virtualenvwrapper, venv, pyvenv, conda, miniconda, poetry, docker, nix. Which ones did I miss? Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

python -m venv myenv . myenv/bin/activate Ensures you have the same python environment. The other part is OS state.

>The other part is OS state

And that's the whole problem. "The same Python environment" doesn't mean much because it underspecifies the full runtime dependency chain.

Re: Pyenv – lets you easily switch between multiple versions of Python

#54

Tools you can use to make sure the Python program you wrote keeps working: requirements.txt, pip, pipenv, pyenv, virtualenv, pyenv-virtualenv, virtualenvwrapper, pyenv-virtualenvwrapper, venv, pyvenv, conda, miniconda, poetry, docker, nix. Which ones did I miss? Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

> Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

Nix does, if you want to actually invest the effort into the "without asterisks" part.

Re: Pyenv – lets you easily switch between multiple versions of Python

#56
post #46

Tools you can use to make sure the Python program you wrote keeps working: requirements.txt, pip, pipenv, pyenv, virtualenv, pyenv-virtualenv, virtualenvwrapper, pyenv-virtualenvwrapper, venv, pyvenv, conda, miniconda, poetry, docker, nix. Which ones did I miss? Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

python -m venv myenv . myenv/bin/activate Ensures you have the same python environment. The other part is OS state.

> Ensures you have the same python environment.

But not the same Python runtime, which does not fulfil the request of guaranteeing it works the same later without asterisks.

Re: Pyenv – lets you easily switch between multiple versions of Python

#57
I have been using pyenv for years and it's the best tool for managing Python versions. You can install any version, switch between them, use different versions for different projects, have multiple versions installed at the same type without problems. It really solved all my Python version managament problems, I never looked for any other tool like this since I started using it.

Re: Pyenv – lets you easily switch between multiple versions of Python

#58
post #12

I have to warn again users that think they have found the silver bullet that pyenv comes with a big caveat: it compiles python on your machine. The number of possible modes of failure in this situation is huge. See also: "Why not tell people to "simply" use pyenv, poetry or anaconda" https://www.bitecode.dev/p/why-not-tell-people-to-simply-use I'm not saying pyenv is not a useful tool, but it is not a tool for beginn…

> it compiles python on your machine What is the alternative? Every solution that I know of on Linux requires you to build Python on the machine: asdf, official Python downloads, etc.

For now most people would do well to stick to python.org installers for mac and windows.

For linux, official repos are ideal. If you really, really can't (which is different than wanting to), ubuntu deadsnake and red hat epl are the best second plan, while already more finicky.

If you use something more exotic, you chose hardship, and you will have to be up to the task.

Anything else will come with bigger caveats than the people promoting them will really admit to.

The story is of course a bit richer because linux packaging is fun, so I'll complete with:

https://www.bitecode.dev/p/installing-python-the-bare-minimu...

Thete are currently no silver bullet to bootstrap python on linux. I tried all of them with hundred of colleagues and trainees.

I do have hope for astral to come up with one but don't run on rye thinking your life is saved.

Re: Pyenv – lets you easily switch between multiple versions of Python

#60
post #19
post #12

Earlier quoted context omitted.

> it compiles python on your machine What is the alternative? Every solution that I know of on Linux requires you to build Python on the machine: asdf, official Python downloads, etc.

Rye downloads pre-built binaries. I'll leave further discussion of the reliability and provenance of said binaries to someone else.

Binaries are quite reliable and from a serious project, but rye is young and uses shim.

Still, it's part of those new generation of tooling that bringing hope for the next few years.

Post reply on HN