top | item 41766035

Python 3.13.0 Is Released

268 points| Siecje | 1 year ago |docs.python.org

132 comments

order

pansa2|1 year ago

Python versions 3.11, 3.12 and now 3.13 have contained far fewer additions to the language than earlier 3.x versions. Instead the newest releases have been focusing on implementation improvements - and in 3.13, the new REPL, experimental JIT & GIL-free options all sound great!

The language itself is (more than) complex enough already - I hope this focus on implementation quality continues.

underdeserver|1 year ago

For those interested in the REPL improvements:

" Python now uses a new interactive shell by default, based on code from the PyPy project. When the user starts the REPL from an interactive terminal, the following new features are now supported:

Multiline editing with history preservation.

Direct support for REPL-specific commands like help, exit, and quit, without the need to call them as functions.

Prompts and tracebacks with color enabled by default.

Interactive help browsing using F1 with a separate command history.

History browsing using F2 that skips output as well as the >>> and … prompts.

“Paste mode” with F3 that makes pasting larger blocks of code easier (press F3 again to return to the regular prompt). "

Sounds cool. Definitely need the history feature, for the few times I can't run IPython.

the__alchemist|1 year ago

I've love to see a revamp of the import system. It is a continuous source of pain points when I write Python. Circular imports all over unless I structure my program explicitly with this in mind. Using python path hacks with `sys` etc to go up a directory too.

formerly_proven|1 year ago

The last couple years also saw a stringent approach to deprecations: If something is marked as deprecated, it WILL be removed in a minor release sooner than later.

pjmlp|1 year ago

Using Python on and off since version 1.6, I always like to point out that the language + standard library is quite complex, even more when taking into account all the variations across versions.

Looking forward to JIT maturing from now onwards.

csdreamer7|1 year ago

> The language itself is (more than) complex enough already - I hope this focus on implementation quality continues.

As do I.

tightbookkeeper|1 year ago

Removing GIL only increases complexity.

wdroz|1 year ago

With the 3.13 TypeIs[0] and the 3.10 TypeGuard[1], we can achieve some of Rust's power (such as the 'if let' pattern) without runtime guarantees.

This is a win for the DX, but this is not yet widely used. For example, "TypeGuard[" appears in only 8k Python files on GitHub.[2]

[0] -- https://docs.python.org/3.13/library/typing.html#typing.Type...

[1] -- https://docs.python.org/3.13/library/typing.html#typing.Type...

[2] -- https://github.com/search?q=%22TypeGuard%5B%22+path%3A*.py&t...

silviogutierrez|1 year ago

Big fan of typing improvements in Python. Any chance you can elaborate on the "if let" pattern in Rust and how it would look in Python now? Not sure I follow how it translates.

Buttons840|1 year ago

What type checker do you recommend?

boarush|1 year ago

Python version from 3.10 have had a very annoying bug with the SSLContext (something related only to glibc) where there are memory leaks when opening new connections to new hosts and eventually causes any service (dockerized in my case) to crash due to OOM. Can still see that the issues have not been resolved in this release which basically makes it very difficult to deploy any production grade service difficult.

infocollector|1 year ago

Can you please link me to a raised issue for this? This sounds concerning.

rkwz|1 year ago

> Free-threaded execution allows for full utilization of the available processing power by running threads in parallel on available CPU cores. While not all software will benefit from this automatically, programs designed with threading in mind will run faster on multi-core hardware.

Would be nice to see performance improvements for libraries like FastAPI, NetworkX etc in future.

v3ss0n|1 year ago

They are not threaded at all.

SubiculumCode|1 year ago

What I've been surprised about is the number of python packages that require specific python versions(e.g., works on 3.10, but not 3.11. Package versioning is already touchy enough without the language itself causing it in minor upgrades.

And will python 3.14 be named pi-thon 3.14. I will see myself out.

ericfrederich|1 year ago

Today someone's pipeline broke because they were using python:3 from Dockerhub and got an unexpected upgrade ;-)

Specifically, pendulum hasn't released a wheel yet for 3.13 so it tried to build from source but it uses Rust and the Python docker image obviously doesn't have Rust installed.

mixmastamyk|1 year ago

Also, Py2 ended approaching Euler’s number, 2.7.18.

CJefferson|1 year ago

Good to get advanced notice, if I read all the way down, that they will silently completely change the behavior of multiprocessing in 3.14 (only on Unix/Linux, in case other people wonder what’s going on), which is going to break a bunch of programs I work with.

I really like using Python, but I can’t keep using it when they just keep breaking things like this. Most people don’t read all the release notes.

nyrikki|1 year ago

You are complaining about spawn()?

both fork() and spawn() are just wrappers around clone() on most libc types anyway.

spawn() was introduced to POSIX in the last century to address some of the problems with fork() especially related to multi threading, so I an curious how your code is so dependent on UTM, yet multi threading.

mixmastamyk|1 year ago

Unfortunately, they learned the wrong lesson from the 2->3 transition. Break things constantly instead of all at once. :p

Still, this one doesn’t seem too bad. Add method=FORK now and forget about it.

almostgotcaught|1 year ago

> I really like using Python, but I can’t keep using it when they just keep breaking things like this.

So much perl clutching. Just curious, since I guess you've made up your mind, what's your plan to migrate away? Or are you hoping maintainers see your comment and reconsider the road-map?

ajay-d|1 year ago

Still in prerelease (RC3), no? At least at time of writing

pansa2|1 year ago

Yeah, the past tense on the What’s New page isn't (yet) accurate:

> Python 3.13 was released on October 7, 2024

stevesimmons|1 year ago

And Azure Functions still doesn't support Python 3.12, released more than a year ago!

benrutter|1 year ago

It was similar last year when 3.12 came out and 3.11 still wasn't supported. I'm really curious what makes azure functions so slow to upgrade available run times, or if it's just that they figure demand for the latest python version isn't there.

cr125rider|1 year ago

We have switched to exclusively using Docker Images in Lambda on AWS cause their runtime team constantly breaks things and is behind with a bunch of releases.

cozzyd|1 year ago

I wonder if FreeCAD supports 3.12 yet. Really annoying that FreeCAD got dropped from the latest Fedora due to breaking python changes...

causal|1 year ago

Any rule of thumb when it comes to adopting Python releases? Is it usually best to wait for the first patch version before using in production?

oebs|1 year ago

We follow this rule (about two dozen services with in total ~100k loc of Python): By default, use the version 1 release below the latest.

I.e. we currently run 3.11 and will now schedule work to upgrade to 3.12, which is expected to be more or less trivial for most services.

The rationale is that some of the (direct and transitive) dependencies will take a while to be compatible with the latest release. And waiting roughly a year is both fast enough to not get too much behind, and slow enough to expect that most dependencies have caught up with the latest release.

instig007|1 year ago

Have a rubust CI and tests, and deploy as early as you can.

zenonu|1 year ago

I'm constrained by libraries with guaranteed version compatibility. Unless you're operating in NIH universe, I bet you are as well.

zahlman|1 year ago

>Any rule of thumb when it comes to adopting Python releases?

No, because it varies widely depending on your use case and your motivations.

>Is it usually best to wait for the first patch version before using in production?

This makes it sound like you're primarily worried about a situation where you host an application and you're worried about Python itself breaking. On the one hand, historically Python has been pretty good about this sort of thing. The bugfixes in patches are usually quite minor, throughout the life cycle of a minor version (despite how many of them there are these days - a lot of that is just because of how big the standard library is). 3.13 has already been through alpha, beta and multiple RCs - they know what they're doing by now. The much greater concern is your dependencies - they aren't likely to have tested on pre-release versions of 3.13, and if they have any non-Python components then either you or they will have to rebuild everything and pray for no major hiccups. And, of course, that applies transitively.

On the other hand, unless you're on 3.8 (dropping out of support), you might not have any good reason to update at all yet. The new no-GIL stuff seems a lot more exciting for new development (since anyone for whom the GIL caused a bottleneck before, will have already developed an acceptable workaround), and I haven't heard a lot about other performance improvements - certainly that hasn't been talked up as much as it was for 3.11 and 3.12. There are a lot of quality-of-implementation improvements this time around, but (at least from what I've paid attention to so far, at least) they seem more oriented towards onboarding newer programmers.

And again, it will be completely different if that isn't your situation. Hobbyists writing new code will have a completely different set of considerations; so will people who primarily maintain mature libraries (for whom "using in production" is someone else's problem); etc.

dagw|1 year ago

Rule 1 is wait until there are built wheels for that version of python for all the libraries that you need. In most cases that can take a month or two, depending on exactly what libraries you use and how obscure they are.

ilc|1 year ago

n-1 is the rule I follow. So if asked today I'd look at 3.12.

HelloNurse|1 year ago

Wait until they are actually released rather than RC3. What's the point of posting prematurely?

yn6n767m76m|1 year ago

Scream into a pillow because even PHP manages to have less breaking releases. Python is a dumpster fire that no one wants to admit or have an honest conversation about. If python 2 is still around my advice is don't upgrade unless you have a clear reason for the new features.

mg|1 year ago

When I'm in a docker container using the Python 3 version that comes with Debian - is there an easy way to swap it out for this version so I can test how my software behaves under 3.13?

silveraxe93|1 year ago

Install `uv` then run `uv run --python 3.13 my_script.py`

gjvc|1 year ago

looking forward to the GraalVM version

BiteCode_dev|1 year ago

I still see Python 3.12.7 being the latest one, with 3.13 delayed because of the GC perf regression. The link, for me, points to the 3.13 RC.

Am I seeing a cached version and you see 3.13 ? Cause I can't see it on the homage page download link either.

fmajid|1 year ago

No, they jumped the gun.

rhnamec|1 year ago

[deleted]

int_19h|1 year ago

If you're making claims about defamation and libel, at least be specific.