News for hackers. Stuff that matters.
Re:Ask HN: Whose building on Python NoGIL? by bionhoward on Friday December 20, 2024 @08:19PM (#42476748)
PyO3 0.23.0 was a big release I’ve been tinkering with extensively. Support for “free-threaded Python” is a headline feature, and I imagine NoGIL Python will be extremely nice for Rust interoperability, so there is definitely interest in that crate. Also could be huge for queueing data for GPUs, api servers, and bulk data fetching.

For whatever reason (maybe post 2to3 PTSD), Python community seems not extremely eager to jump on latest versions of Python and it often takes a long time for popular libraries to support the latest and greatest, so I’d recommend patience and baby steps

https://github.com/PyO3/pyo3/releases/tag/v0.23.0

Re:Ask HN: Whose building on Python NoGIL? by hamandcheese on Saturday December 21, 2024 @06:56PM (#42483323)
> For whatever reason (maybe post 2to3 PTSD), Python community seems not extremely eager to jump on latest versions of Python

Well, you'd think after the 2 to 3 debacle, python might take backwards compatibility more seriously, but they don't.

Follow semver, and stop breaking things on 3.x. If it's deprecated in 3.x, don't remove it until 4.

Re:Ask HN: Whose building on Python NoGIL? by throwaway127482 on Saturday December 21, 2024 @07:45PM (#42483562)
What have they broken on 3.x? Genuine question as I haven't followed python's development super closely
Re:Ask HN: Whose building on Python NoGIL? by skeledrew on Saturday December 21, 2024 @09:43PM (#42484041)
Some seldom used standard modules have been deprecated and later removed. Like recently I revisited a project I initially made using v3.6, but it broke on v3.13 due to an indirect dependency no longer present in the stdlib. It was a simple fix though as a quick search identified the issue and pointed to the removed module in a package on PyPI.
Re:Ask HN: Whose building on Python NoGIL? by hamandcheese on Sunday December 22, 2024 @01:52AM (#42484803)
Yeah, it's nothing crazy, but it makes upgrades a lot more unpredictable. It's harder to communicate to management why the 3.x update took a day and the 3.y upgrade took a whole quarter.

It's harder to upgrade services in a central way with any amount of leverage, and generally requires more coordination overhead, and moving more carefully.

Compare with, say, golang, where it's pretty much a non-issue. My experience with Ruby was a lot better too, until Ruby 3, but hey, that was a major version bump!

Re:Ask HN: Whose building on Python NoGIL? by fulafel on Sunday December 22, 2024 @02:33AM (#42484918)
Python 3.6 is from 2016 and 3.13 is from 2024. Similar things happen on most platforms on this timescale, eg on the Java side[1], you'd be going from Java 8 to Java 23.

Clojure is pretty good even on that timescale though.

[1] See eg https://stackoverflow.com/a/50445603 up until 2021

Re:Ask HN: Whose building on Python NoGIL? by skeledrew on Sunday December 22, 2024 @12:56PM (#42487946)
Yep it's totally understandable, and OK by me as these changes are documented in the release docs and the fix a pip install away.
Re:Ask HN: Whose building on Python NoGIL? by trallnag on Monday December 23, 2024 @04:53AM (#42493191)
I often see people recommending Python as a replacement for Bash scripts (utilizing common Unix tools like grep and awk). I'm pretty sure a script from 2016 will still be working fine now.
Re:Ask HN: Whose building on Python NoGIL? by swiftcoder on Monday December 23, 2024 @05:03AM (#42493241)
> I'm pretty sure a bash script from 2016 will still be working fine now.

In some environments, yes. A bunch of platforms have started using bash-compatible (but not actually bash) shells like fish to help with startup performance. Apple has upgraded from a truly ancient version of bash to a somewhat-modern one in that time (and then gone all-in on zsh instead). Things change on the scale of a decade.

Re:Ask HN: Whose building on Python NoGIL? by jkaplowitz on Tuesday December 24, 2024 @12:12PM (#42503214)
And yet, if the script is written to POSIX sh standards and has the #!/bin/sh shebang line, none of that breaks.

Yes, of course, things do change incompatibly in a decade, probably including some of the nonstandard platform-specific commands called by the script regardless of which dialect of shell. But people who use a nonstandard shell dialect - however common it might be at the time of writing - should be prepared for that shell to become uncommon, absent by default, installed at a different path, incompatibly changed, or otherwise unusable a decade later to an extent that people writing to the standard do not.

Re:Ask HN: Whose building on Python NoGIL? by nuancebydefault on Monday December 23, 2024 @10:14AM (#42494954)
The bash side will still work but the tools called by bash won't. Same goes for python/packages.
Re:Ask HN: Whose building on Python NoGIL? by Too on Tuesday December 24, 2024 @02:07AM (#42500189)
Assuming the script even worked fine in the first place. Usually quite unlikely.
Re:Ask HN: Whose building on Python NoGIL? by fulafel on Wednesday December 25, 2024 @02:55AM (#42507579)
They break more often than Python scripts, from reasons unrelated to bash versions, though.
Re:Ask HN: Whose building on Python NoGIL? by SOLAR_FIELDS on Sunday December 22, 2024 @12:18PM (#42487701)
Removal of setuptools in 3.12 broke a ton of legacy builds. Basically created a wall of forced package upgrades for a huge amount of packages in PypI where end users have to bump a bunch of stuff if they want to migrate from < 3.12 to 3.12+
Re:Ask HN: Whose building on Python NoGIL? by Flimm on Sunday December 22, 2024 @04:06PM (#42489101)
setuptools was never part of Python's standard library. I think you're thinking of distutils which was removed from Python in the 3.12 release. You can easily access distutils again by installing a package from PyPI.
Re:Ask HN: Whose building on Python NoGIL? by SOLAR_FIELDS on Sunday December 22, 2024 @11:33PM (#42491812)
You are right, it was distutils. Good call out. Not sure why I thought of setuptools.
Re:Ask HN: Whose building on Python NoGIL? by JamesonNetworks on Monday December 23, 2024 @06:41AM (#42493700)
This comment thread is a microcosm of the problems with python packaging :D I appreciate the work the ecosystem does on it and everyone is doing their best, but its still a hard problem that doesn't feel solved
Re:Ask HN: Whose building on Python NoGIL? by feznyng on Wednesday December 25, 2024 @12:43PM (#42509949)
Check out uv if you haven’t.
Re:Ask HN: Whose building on Python NoGIL? by CamouflagedKiwi on Monday December 23, 2024 @05:33AM (#42493383)
One that I ran into at previous job: 3.10 removes the ability to implicit cast floats to ints in a bunch of places. That was very much a breaking change for a bunch of code out there.
Re:Ask HN: Whose building on Python NoGIL? by pletnes on Monday December 23, 2024 @09:04AM (#42494434)
Never heard of. Do you have any concrete examples? Would be good to know about for me in 2025.
Re:Ask HN: Whose building on Python NoGIL? by brianwawok on Tuesday December 24, 2024 @07:11PM (#42505923)
Comparing ints and floats sounds like a pretty high nono in basically any language ever. Why more python projects should use MyPy and not freely switch float to int to decimal. They aren’t the same thing.
Re:Ask HN: Whose building on Python NoGIL? by Kwpolska on Monday December 23, 2024 @07:38AM (#42493977)
They have been removing features every release for the past few years. Code that was working fine on 3.10 may break on 3.13 just because it was using a feature they didn't like.
Re:Ask HN: Whose building on Python NoGIL? by formerly_proven on Monday December 23, 2024 @08:53AM (#42494372)
Every release removes / breaks stuff in the standard library and has been for a while. That's because prior to ~3.2 or so, deprecations were basically never followed up on, but now deprecation means it's going to be removed.

E.g. Python 3.12 has deprecated datetime.utcnow(). So it will probably be removed in Python 3.14 or 3.15.

For all intents and purposes, "Python 3" is now the brand and "Python 3.x" releases are major, breaking releases.

Re:Ask HN: Whose building on Python NoGIL? by physicsguy on Tuesday December 24, 2024 @03:29AM (#42500522)
The async initial implementation changed in such a way as to break existing code
Re:Ask HN: Whose building on Python NoGIL? by skeledrew on Saturday December 21, 2024 @09:34PM (#42484011)
I don't think there's even a plan for a v4. The fallout from 2 to 3 was that bad. So to keep improvements going takes deprecating something several versions before removing, and research is done to find how popular that particular thing is to determine its candidacy for removal. Thus it's best practice to pin all dependencies, and read the release notes before doing a version update.
Re:Ask HN: Whose building on Python NoGIL? by Numerlor on Saturday December 21, 2024 @10:09PM (#42484128)
Yeah it'd be better if the name was understood as python 3 instead of just python to avoid mixing in semver
Re:Ask HN: Whose building on Python NoGIL? by Uptrenda on Monday December 23, 2024 @02:11AM (#42492454)
My thoughts exactly. Python was supposed to be this ultra-portable thing. But... I am finding myself having to write patches to get my software to work on different Python versions.

People who have Python 3 installed can be on many different versions. The thing is, depending on the version, quite often bug fixes included in later versions aren't in older versions. So if you want to make your code work -- got to get the patches in manually, monkey patch broken code, and do it that way. Then there's the seemingly random deprecation of standard library modules / other breaking changes.

I take python version support seriously because if people install your packages you'll be outsourcing all of the above crap to the user. They might not even know how to 'upgrade' python. Or end up on the wrong version. If your package doesn't work when they install it they'll just move on to something else. Python is a total shit show for packaging.

Re:Ask HN: Whose building on Python NoGIL? by trollbridge on Monday December 23, 2024 @07:30AM (#42493926)
I use Poetry and pin the Python version. Ugly, but it works.
Re:Ask HN: Whose building on Python NoGIL? by holdenweb on Monday December 23, 2024 @09:16AM (#42494504)
Given the many ways of creating virtual environments it's becoming more usual for a program's installation to create a specialist virtual environment just to support that application (pre-commit is. good example of this technique). Perhaps that'a a way ahead?
Re:Ask HN: Whose building on Python NoGIL? by pjc50 on Monday December 23, 2024 @09:44AM (#42494719)
This is almost mandatory if you want to ship something which might be considered "standalone" on Python.
Re:Ask HN: Whose building on Python NoGIL? by trollbridge on Tuesday December 24, 2024 @07:37AM (#42501530)
It's quite ugly, and I try to make sure I write modules that can be built to a standard wheel and installed that way. (Poetry makes this fairly easy, incidentally.)

Doing development on the projects without a specialised build environment, though, is almost hopeless. You either have to manually install a bunch of stuff (e.g. I use ruff, used to use ruff and black, used pre-commit, and a few other things), and then there's the non-Python things that need to be installed (like specific fonts in my case). At this point I just impose Poetry as basically a requirement for development.

The program does build and function in a non-Poetry environment which is what I use for production.

Re:Ask HN: Whose building on Python NoGIL? by sgarland on Monday December 23, 2024 @09:14AM (#42494496)
Python doesn’t follow semver [0], it follows a general major.minor.bugfix, but with an extremely liberal definition of minor (“less earth-shattering,” as they describe it).

PEP387 requires that introduced incompatibilities have a “large benefit to breakage ratio,” and that any deprecations last a minimum of two years.

FWIW, Kubernetes has a similar approach. Breaking changes occur all the time with “minor” version updates.

[0]: https://docs.python.org/3/faq/general.html

[1]: https://peps.python.org/pep-0387/

Re:Ask HN: Whose building on Python NoGIL? by ensignavenger on Monday December 23, 2024 @09:18AM (#42494522)
Why should Python follow semver? There are plenty of successful projects that don't use semver. If you feel so strongly about them making the change, than make a case for it.
Re:Ask HN: Whose building on Python NoGIL? by brianwawok on Tuesday December 24, 2024 @07:09PM (#42505911)
Meh. I’d rather we move faster and make the world better even if we have to update code a bit more. Never that hard.
Re:Ask HN: Whose building on Python NoGIL? by KronisLV on Wednesday December 25, 2024 @06:20AM (#42508248)
I’ve seen woefully outdated enterprise projects that are unlikely to ever be updated to new runtimes (think Java 8 to anything newer, alongside the limitations JDK version support brings), due to nobody having the manpower to port up to a million lines over while hoping for it to be bug for bug compatible.

Moving fast is really nice when you can get paid for shipping and have the project either be retired or someone else’s problem in a decade.

Re:Ask HN: Whose building on Python NoGIL? by KaiserPro on Friday December 27, 2024 @04:01PM (#42525990)
Updates cost money, or time.

Most places don't have the resources to keep updating everything for little benefit. (just look at node its terrible to support. )

Re:Ask HN: Whose building on Python NoGIL? by weinzierl on Monday December 23, 2024 @04:59AM (#42493219)
Oh, what a surprise, I thought PyO3 was dead. Glad to see it's not!
Re:Ask HN: Whose building on Python NoGIL? by CamouflagedKiwi on Monday December 23, 2024 @05:38AM (#42493406)
> For whatever reason (maybe post 2to3 PTSD), Python community seems not extremely eager to jump on latest versions of Python

I don't think it's the 2 -> 3 thing any more, that was a while ago. Honestly there are just a lot of things that don't work well in 3.x.0 Python releases. For example, 3.12.0 had the per-interpreter GIL thing; I tried that in 3.12.0 and ran into a completely breaking issue almost immediately. They were responsive & helpful and did fix the first issue in 3.12.1, but we still had more issues with parts of the C API which seemed to work in 3.11 and better again in 3.13, but it really felt like that needed another release to solidify. (Also you can't import datetime in that setup in 3.12, which is also a pretty big deal-breaker).

I can only imagine the free-threading thing will need at least the same kind of time to work the kinks out, although it is nice to see them moving in that direction.

Re:Ask HN: Whose building on Python NoGIL? by scott_w on Monday December 23, 2024 @10:35AM (#42495121)
> For whatever reason (maybe post 2to3 PTSD), Python community seems not extremely eager to jump on latest versions of Python

I suspect this is a mix of Python 3 being “good enough” for most cases and companies not updating their stacks that often. I think most of us came into Python professionally around 2.7 so the need to keep updating our version hasn’t been heavily ingrained into our thinking.