python-build-standalone icon indicating copy to clipboard operation
python-build-standalone copied to clipboard

Add python 3.13 free-threaded build

Open bschoenmaeckers opened this issue 1 year ago • 5 comments

The free-threaded build of python is still in beta but it would be great to make it available so users can test it.

ref #263, #319

bschoenmaeckers avatar Sep 06 '24 16:09 bschoenmaeckers

I'll start working on this.

zanieb avatar Sep 08 '24 14:09 zanieb

So I got the builds working on macOS (woo) but I don't know how to tag them?

If we have cpython-3.13.0rc2-aarch64-apple-darwin-noopt-20240907T1906.tar.zst how are we supposed to add a free-threaded tag? e.g. 3.13.0rc2t and 3.13.0trc2 are both "invalid" versions.

Similarly, in uv we'll need a way for users to request these versions. I thought --python 3.13t made sense but the collision with pre-release tags is a problematic. We can definitely strip the t when parsing the version but I'm not sure if it's "the right thing".

zanieb avatar Sep 08 '24 15:09 zanieb

Fedora just called its free-threaded binary RPM python3.13-freethreading rather than trying to abbreviate at that level. The t flag is part of the ABI tag rather than part of the version number, so formats that are looking for the true version number won't accept it.

I'm not sure what the noopt in the cpython-3.13.0rc2-aarch64-apple-darwin-noopt-20240907T1906.tar.zst, but if it indicates the "default, with no options" build, then cpython-3.13.0rc2-aarch64-apple-darwin-freethreading-20240907T1906.tar.zst may work.

At request time, accepting python3.13t matches the installed binary name, so it seems like the most straightforward solution.

Edit: oh, I see what you mean with the second question. How to request an exact version (down to the minor release number, or even pre-release serial), while still adding the t suffix. I'd suggest requiring an extra underscore for those cases: 3.13.0rc2_t, 3.13.0_t, 3.14.0a1_t, etc. I started a Discourse thread for that idea here: https://discuss.python.org/t/suggested-convention-for-a-free-threading-build-marker-on-exact-python-versions/63279

Edit 2: Zanie clarified that noopt is "only default optimizations", rather than "only default options", so it isn't relevant here.

ncoghlan avatar Sep 08 '24 17:09 ncoghlan

It should go in the build configuration "field" denoted by a +. Eg. freethreaded+pgo

indygreg avatar Sep 08 '24 17:09 indygreg

👍 cool thanks, that makes sense per the description at https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions

We'll need to figure out the ux in uv, I believe right now we only expose one build option variant to users at a time. But we can track that in https://github.com/astral-sh/uv/issues/4828 and https://github.com/astral-sh/uv/issues/7193.

zanieb avatar Sep 08 '24 17:09 zanieb