News for hackers. Stuff that matters.
Re:GIL Become Optional in Python 3.13 by Elucalidavah on Monday August 12, 2024 @02:57AM (#41221818)
> The one big problem it has is that it keeps changing

What prevents you from using an old Python version?

Re:GIL Become Optional in Python 3.13 by CJefferson on Monday August 12, 2024 @03:15AM (#41221926)
I'd love to stick with python 2.7 forever, but it isn't getting even minor updates just to keep up to date with operating system updates, and is starting to stop being packaged.

My current solution is a docker container which includes python 2.7 and a downloaded copy of every package I use.

Re:GIL Become Optional in Python 3.13 by etrautmann on Monday August 12, 2024 @03:56AM (#41222157)
What do you prefer about it?
Re:GIL Become Optional in Python 3.13 by nlitened on Monday August 12, 2024 @04:45AM (#41222435)
That it has a lot of my old code working perfectly for years, and I don't have spare time to port it to another language and keep catching subtle bugs for months.
Re:GIL Become Optional in Python 3.13 by rglullis on Monday August 12, 2024 @05:19AM (#41222627)
Out of curiosity, how many lines of code are we talking about here?
Re:GIL Become Optional in Python 3.13 by imtringued on Monday August 12, 2024 @09:07AM (#41223970)
"Port it to another language". You're saying this as if the minor asinine breaks in python 2 Vs 3 make it a whole new programming language, when in reality it is mostly bullshit like print going from statement to function.
Re:GIL Become Optional in Python 3.13 by CJefferson on Monday August 12, 2024 @03:58PM (#41228641)
My problem is some libraries which never transitioned from 2 to 3. I don't want to try to convert them, particularly as they involve Unicode which is one of the hardest bits to get right in my experience.
Re:GIL Become Optional in Python 3.13 by skeledrew on Monday August 12, 2024 @10:08PM (#41231468)
Improved unicode (string vs byte separation) handling was exactly one of the larger reasons for the breaking change to 3.
Re:GIL Become Optional in Python 3.13 by CJefferson on Tuesday August 13, 2024 @04:54AM (#41233601)
You are right that unicode is much better in 3, but in my experience this is a pain point mapping programs 2 -> 3, because often programs seem to work fine until there is some exciting unicode, or malformed characters, in the input, then they crash when they used to just rumble on.
Re:GIL Become Optional in Python 3.13 by skeledrew on Wednesday August 14, 2024 @12:47AM (#41242650)
That sounds about right. Fail fast and loud so things have to be fixed, rather than continue silently and likely corrupt data.
Re:GIL Become Optional in Python 3.13 by guappa on Monday August 12, 2024 @03:36AM (#41222038)
> What prevents you from using an old Python version?

I think the fact that it's not on the distributions is a major factor here.

Re:GIL Become Optional in Python 3.13 by dijit on Monday August 12, 2024 @03:01AM (#41221851)
Usually us plebs use the system python.

With no python version manager (I don’t even know any off the top of my head).

Also virtualenvs only get you so far, I’ve come back to many projects on my machine with broken virtualenvs, I guess due to some dynamically linked dependency of python that my system no longer has.

:(

Re:GIL Become Optional in Python 3.13 by ok_dad on Monday August 12, 2024 @03:28AM (#41221996)
> With no python version manager (I don’t even know any off the top of my head)

Try a tool called `pyenv`. It's pretty great. I pair it with the package manager called `poetry`.

Re:GIL Become Optional in Python 3.13 by Joeboy on Monday August 12, 2024 @08:51AM (#41223839)
Or https://github.com/astral-sh/uv can replace both. Various features are tagged as "experimental", and I guess the api might change, but it seems to work already. I have high hopes for it eventually making python's fragmented package management issues go away.

Edit: Somebody's going to respond with the XKCD aren't they? I know about the XKCD and I nevertheless have high hopes for `uv`.

Re:GIL Become Optional in Python 3.13 by Izkata on Monday August 12, 2024 @12:04PM (#41226013)
Looks like pyenv does the same thing as asdf, except only for python.

https://github.com/asdf-vm/asdf

And here's a list of everything it supports: https://github.com/asdf-vm/asdf-plugins/tree/master/plugins

Re:GIL Become Optional in Python 3.13 by jashmatthews on Monday August 12, 2024 @04:22AM (#41222310)
It's the sledgehammer approach but... Docker?
Re:GIL Become Optional in Python 3.13 by mort96 on Monday August 12, 2024 @07:37AM (#41223333)
Using Docker in order to avoid ever updating Python sounds like a great way to end up in severe tech debt tbh
Re:GIL Become Optional in Python 3.13 by p_l on Monday August 12, 2024 @01:30PM (#41227082)
Arguably it was also non-trivial part of why some places started using Docker...
Re:GIL Become Optional in Python 3.13 by wakawaka28 on Monday August 12, 2024 @03:08AM (#41221894)
Using an old Python version means you're stuck using libraries that work with that version. I think you have to figure out which ones work on your own as well.
Re:GIL Become Optional in Python 3.13 by scrollaway on Monday August 12, 2024 @03:12AM (#41221910)
Because libraries also change, for the same reason as python changes: To keep up with compatibility of newer devices, systems, and usage patterns.

Beside, "figure out which ones work" is a solved issue with a package manager such as poetry.

Re:GIL Become Optional in Python 3.13 by rowanG077 on Monday August 12, 2024 @03:16AM (#41221932)
That is if all libraries were super stringent in their dependency bounds. Which in my experience no one is. So it's a crapshoot if it will work or not.
Re:GIL Become Optional in Python 3.13 by SOLAR_FIELDS on Monday August 12, 2024 @03:57AM (#41222164)
This is more of an indictment on how bad Python is about mixing system level packages with library dependencies than anything else. The classic example I always give is psycopg2 depending on a system install of Postgres client library.
Re:GIL Become Optional in Python 3.13 by imtringued on Monday August 12, 2024 @09:16AM (#41224030)
The irritating thing about python is that since it is mostly glue around C, all the annoying things about C leak through.
Re:GIL Become Optional in Python 3.13 by wakawaka28 on Monday August 12, 2024 @01:53PM (#41227353)
It's not a solved issue, as others have pointed out. To elaborate, most packages are not maintained continuously. Some don't get updates anymore and some get updates that break older versions of Python. The authors of these libraries definitely aren't rooting out all the problems that can occur due to mismatched versions. And when you change one library, any other related library can be affected. It's like solving a puzzle sometimes. In many cases people throw up their hands and say "forget this, I'm not upgrading anything!" This is also the big driver of solutions like virtualenv and Docker. All languages have this issue to some extent but Python breaks stuff more often than anything else I use.

I don't especially like language-specific package downloaders either but that's not a Python-only problem, and there are tradeoffs to pushing the work downstream into more stable systems.

Re:GIL Become Optional in Python 3.13 by mort96 on Monday August 12, 2024 @04:40AM (#41222406)
Being able to use the system's Python (or in the case of macOS, Homebrew's Python) is extremely convenient. Especially when Python is used as a language for build scripts across a team. I'm not interested in forking Python taking on the responsibility of maintaining, packaging and distributing Python across a range of platforms.