indygreg / python-build-standalone

Produce redistributable builds of Python
Mozilla Public License 2.0
2.11k stars 133 forks source link

Add python 3.13 free-threaded build #320

Closed bschoenmaeckers closed 1 month ago

bschoenmaeckers commented 2 months ago

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

zanieb commented 2 months ago

I'll start working on this.

zanieb commented 2 months ago

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".

ncoghlan commented 2 months ago

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.

indygreg commented 2 months ago

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

zanieb commented 2 months ago

👍 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.