Skip to content

Commit

Permalink
Update 2024-09-11-python313.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ddemaio committed Sep 11, 2024
1 parent 4d30b1a commit fa2a9b1
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions _posts/2024/2024-09-11-python313.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
author: Daniel García Moreno
date: 2024-09-11 08:00:00+20:00
date: 2024-09-11 11:00:00+02:00
layout: post
image: /wp-content/uploads/2020/09/pythonlogo.png
license: CC-BY-SA-3.0
slug: python313
title: Python 3.13, with and without GIL
image: /wp-content/uploads/2020/09/pythonlogo.png
categories:
- Announcements
- Tumbleweed
Expand All @@ -16,52 +16,35 @@ tags:
- SUSE
- Developers
- Open Source

---

Python 3.13 RC2 is now available in Tumbleweed. This new version of
the Python interpreter will be released in October 2024.
Python 3.13 RC2 is now available in [Tumbleweed](https://get.opensuse.org/tumbleweed/). This new version of
the [Python](https://www.python.org/) interpreter will be released in October 2024.

There's [a lot of changes](https://www.python.org/downloads/release/python-3130rc2/)
and new features in 3.13, but we're also bringing exiting experimental
features in Tumbleweed.
There is [a lot of changes](https://www.python.org/downloads/release/python-3130rc2/) and new features in 3.13, but we're also bringing exiting experimental features in Tumbleweed.

### Experimental JIT compiler

The default (`python313`) build has the flag
`--enable-experimental-jit=yes-off`. This means that if you want to
use this [experimental JIT](https://docs.python.org/3.13/whatsnew/3.13.html#an-experimental-just-in-time-jit-compiler)
you can enable with a environment variable:
The default (`python313`) build has the flag `--enable-experimental-jit=yes-off`. This means that if you want to use this [experimental JIT](https://docs.python.org/3.13/whatsnew/3.13.html#an-experimental-just-in-time-jit-compiler) you can enable with an environment variable:

```
$ PYTHON_JIT=1 python313
```

You can find more information about the JIT compiler and how can this
improve the performance in the
You can find more information about the JIT compiler and how it can improve performance in
[PEP-744](https://peps.python.org/pep-0744/).

### Free threaded CPython (no GIL)

With this new version of Python interpreter there's an option to build
without the famous [Global Interpreter Lock](https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython),
aka GIL. This is a really experimental feature, but why not have this
on Tumbleweed? So we decided to build also this new version with a new
package `python313-nogil`.
With this new version of Python interpreter, there is an option to build without the famous [Global Interpreter Lock](https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython), aka GIL. This is a really experimental feature, but why not have this on Tumbleweed? So we decided to build also this new version with a new package `python313-nogil`.

This new package is an isolated interpreter, so you can install
without conflicts with `python313`. The package is building with the
`--disable-gil` option and it provides the `/usr/bin/python3.13t`
binary. It uses by default `/usr/lib/python3.13t/site-packages` for
third-party libs, so with the default configuration it won't use any
This new package is an isolated interpreter, so you can install without conflicts with `python313`. The package is building with the `--disable-gil` option and it provides the `/usr/bin/python3.13t` binary. It uses by default `/usr/lib/python3.13t/site-packages` for third-party libs so, with the default configuration, it won't use any
python 3.13 module.

This means that now you can use `threading.Thread` in the Python
interpreter and it will be actual threads, so at the end using threads
with `python3.13t` interpreter should be a lot faster.
This means that now you can use `threading.Thread` in the Python interpreter, and it will be actual threads so, at the end using threads with `python3.13t`, interpreter should be a lot faster.

There's no packages for this interpreter in Tumbleweed, at this
moment. So if you want to use third party libraries you should use
virtualenv and pip for that:
There's no packages for this interpreter in Tumbleweed, at this moment. So if you want to use third party libraries you should use `virtualenv` and `pip` for that:

```
$ python3.13t -m venv free-threaded-env
Expand All @@ -73,3 +56,5 @@ Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; sys._is_gil_enabled()
False
```

<meta name="openSUSE, Tumbleweed, Developers, sysadmin, user, Open Source, rolling release, python, pip, virtualenv" content="HTML,CSS,XML,JavaScript">

0 comments on commit fa2a9b1

Please sign in to comment.