News for hackers. Stuff that matters.
Re:Pyenv – lets you easily switch between multiple versions ... by rbanffy on Monday March 25, 2024 @09:54AM (#39816333)
> Every solution that I know of on Linux requires you to build Python on the machine

Unless you need a Python that's not supported by your Linux distribution, you can just use what's available.

On macOS, MacPorts provides compiled versions for 3.2 all the way to 3.13, as well as 2.6 and 2.7. Right now, I have 3.8, 3.9, 3.10, 3.11, 3.12, and a 3.13 development build. The fact it's not Linux (or x86) might cause some frustration.

Re:Pyenv – lets you easily switch between multiple versions ... by SOLAR_FIELDS on Monday March 25, 2024 @10:12AM (#39816572)
If you’re lucky enough to be on a Linux system that uses apt some thankless soul maintains a repo called deadsnakes with all these binaries. Fabulous if you’re using any somewhat old version of Python in CI for instance. Yum based systems are SOL as far as I can tell. Build and host your own binary for that. Apk doesn’t have this either IIRC
Re:Pyenv – lets you easily switch between multiple versions ... by rbanffy on Monday March 25, 2024 @10:16AM (#39816626)
If you are deploying to such an ancient OS, it's perhaps easier to have the whole OS packaged as a container or a VM and use that. It's not only different Python versions that might bite you.
Re:Pyenv – lets you easily switch between multiple versions ... by Hackbraten on Monday March 25, 2024 @02:00PM (#39819420)
What makes you think that GP’s comment is talking about older OSes?

My understanding of their comment is that they’re talking about getting older Python interpreters to run on more modern OSes, modern enough that they don’t carry the older Python as a system package anymore. Hence, deadsnakes.

Re:Pyenv – lets you easily switch between multiple versions ... by SOLAR_FIELDS on Monday March 25, 2024 @10:19PM (#39823680)
This is not about system packages or OSes, this is about your application needing Python 3.9.7 specifically, and locking to that, and 3.9.7 not being available in repositories anymore (3.9.7 is just an example). So normally you would either need to self host 3.9.7 somewhere or compile it from source on every new machine (which is terrible for CI but fine for local dev, a one off in local dev to build a Python version is nothing but paying 4 minutes every time on ci to compile your version of Python from source is a very angry amount of time for a lot of people).
Re:Pyenv – lets you easily switch between multiple versions ... by rbanffy on Tuesday March 26, 2024 @10:26AM (#39828257)
> needing Python 3.9.7 specifically

That's indeed extremely specific. I'd imagine this pain could be self-inflicted with C-based extensions that were compiled (and can't be recompiled) with structures that don't exist in other versions.

I don't want to imagine what other eldritch horrors await developers working on this application.

Re:Pyenv – lets you easily switch between multiple versions ... by SOLAR_FIELDS on Wednesday March 27, 2024 @02:44AM (#39836257)
Usually it is not the patch version being important eg being specifically 3.9.7, but rather picking one supported version and pinning it. Yes we should all be on the latest Python version that is available in the mainline repos and distros as a binary but a lot of orgs I’ve seen don’t invest the time and effort to properly be upgrading to be on the latest version of deps. So you are usually having one specific supported Python version that everyone builds against which may or may not be new enough to be in the official repo.

I also imagine the scenario you mentioned causing a lock to a patch version. But I see this as just a normal steady state a lot of orgs drift to if not staying on top of version updates

Re:Pyenv – lets you easily switch between multiple versions ... by hermitdev on Monday March 25, 2024 @10:50AM (#39817032)
deadsnakes is useful, but also a bit of a misnomer. One can use it to get pretty much anything python version, even ones that are too new to be available in your default apt repos. That is, it's not just for 'dead'/EOL versions.
Re:Pyenv – lets you easily switch between multiple versions ... by BiteCode_dev on Monday March 25, 2024 @01:10PM (#39818795)
The thankless soul is the awesome Anthony Sottile, who is also the author of pre-commit.ci: https://twitter.com/codewithanthony

Drop by and send thanks cause he really needs them.

Re:Pyenv – lets you easily switch between multiple versions ... by bmitc on Monday March 25, 2024 @03:10PM (#39820173)
That's exactly why I don't really on that for Ubuntu though. It's a single point of failure, when I can just use `asdf` to install Python and easily switch between it, automatically if setup correctly on projects.
Re:Pyenv – lets you easily switch between multiple versions ... by SOLAR_FIELDS on Monday March 25, 2024 @10:11PM (#39823625)
I use asdf on my local machine, stuff like deadsnakes is for when you need your CI to use VaguelyOldButStillSupported Python version and don’t want to either compile Python from source or host your own binary
Re:Pyenv – lets you easily switch between multiple versions ... by bmitc on Tuesday March 26, 2024 @07:31AM (#39826550)
My use case is that I'm almost always using the latest Python version, which many Linux distros don't have in their packaging yet, and I'm upgrading code using old versions to the latest. asdf is the best tool for that.