Live data from Hacker News

Pyenv – lets you easily switch between multiple versions of Python

github.com

91–100 of 341 posts

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

#91
post #28

Homebrew really bugs me. The devs want you to use the most current version of Python. Except the requirement is set at the package level and there's no enforcement. So you just keep getting python versions installed. I don't get why you just don't set a minimum version like every other manager. Or if you want to do this crazy thing, don't rely on package maintainers to enforce it. I just ends up in major bloat

This is misleading. The older versions get cleaned out as brew does the upgrades (if not, then check your brew settings). My take on brew's Python is that it is there to make sure there is a uniform runtime for everything with a Python dependency, but I am not required to use it.

As. Homebrew maintainer: confirmed. You can also adjust your settings to pin versions or avoid cleanup, too.

‘brew pyenv-sync’ may be useful around this area, too.

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

#92
Not really a complaint - but I am surprised to see this on the front page of HN. This is an enormously popular project that's been around for over a decade that basically anyone who writes Python regularly is aware of.

Only marginally less surprising than seeing a link directly to python.org.

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

#93

Just use the builtin "python -m venv" and life is good, why the others? I tried almost all of them, with various issues, now staying with the default venv, it's solid and get the job done.

Yeah, my thoughts exactly. I’ve never found myself in a situation where venv did not do exactly what I needed it to do.

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

#94

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…

> 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

Just curious: what are the downsides of poetry installed with pipx? The article mentions having to install poetry in another venv, but that's hardly an issue with pipx (you just add an 'x' after 'pip'), and installing pipx is as straight-forward as it can be.

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

#96
post #78

Earlier quoted context omitted.

I'm not sure what you might mean by runtime, but a python venv does make sure you're using the same runtime. There are symlinks in the environments bin directory to the specific runtime. If you're plonking a python3.12 binary over the top of the python3.11 one, then yeah, you'll be using a different one, but that'd be an issue nomatter what you're using. Just don't uninstall your python binaries and you're fine. If y…

> but a python venv does make sure you're using the same runtime. It does not. > There are symlinks in the environments bin directory to the specific runtime. Precisely. They symlink to a path . Which means that if you have a certain version of Python at one location (let’s say /usr/bin/python3) and later update that (let’s say by upgrading macOS and the Xcode developer tools), the same virtual environment will point…

You can use --copies if you don't want symlinks [0].

[0]: https://docs.python.org/3/library/venv.html

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

#97
post #66

I've given up on trying to manage runtime dependencies with language specific tooling. Instead, I've moved to mise which handles the majority of them (Python, Node, Ruby, Terraform, etc.) the same way. It will also activate Python virtual envs: https://mise.jdx.dev/lang/python.html It has other nice helpers for development environments (tasks, env variables, etc.).

And for those of you that are already on asdf-vm, it is compatible with most of those plugins. I have not yet made the jump but I'm tempted.

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

#98
post #3

OP - I'm curious why you've submitted this today, you seem experienced enough to guess this is not the first time you've used it. Has there been a major change or something happened in the community I need to know about? Or are you just spreading the love for a great piece of open source software?

There are always new developers coming onboard that might have missed this handy tool. It's worth firing up the conversation on occasion.

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

#99

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 didn’t miss Poetry, but I have to say up until I started using Poetry python in large projects was a pain in the tooling department to setup and maintain over longer periods of time. It’s no panacea, but feels more stable and usable (especially from onboarding new team members PoV) than other tooling I’ve tried

What does poetry deliver beyond what pyenv gets you? I haven't used either tool super extensively.
Post reply on HN