Run pants under free threaded python#23477
Open
tobni wants to merge 9 commits into
Open
Conversation
Draft
c68208d to
d3a9c73
Compare
Contributor
Contributor
Author
|
@cburroughs Risk is close to none afaik, it is mostly a pyo3 compat (meaning we couldnt build it) issue. If we are allowed to assume pants is ran as a scie we defined, the internal 3rd party lockfile does the rest. I think that is ok, building a pants dist and targeting a different python would be highly special usecase. If a plugin uses native deps in rule code that could bite them iff there is no 3.14t wheels for them. |
d3a9c73 to
6a60274
Compare
6a60274 to
b03a612
Compare
Member
|
Pretty substantial (and consequential) change - so I tacked on a bunch of reviewers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switches Pants' own runtime to free-threaded CPython and makes the engine and
Pants' Python code thread-safe without the GIL.
This has been validated as running without error in my companies CI, and nets great speedups.
Most important callouts:
this, every
Python::attachcycle tears down the thread state, and on 3.14tthat abandons the thread's mimalloc heaps. Created per tokio thread, torn down in
on_thread_stop(blockingthreads are recycled, so the state must not leak per thread creation).
PBS does not ship debug-symbol stripped binaries for free threaded python, which means pants-scie downloads a fatter artifact.Fooled by stale validation / docs. Stripped, free threaded PBS builds are available, but requires upstream changes in lift (Accept freethreaded install_only PBS flavors a-scie/lift#200) and pex (no PR but john likely only needs signs of life on our end as per Upgrade to Python 3.14 #22769 (comment).I used #23437 as a launching point.
I have on speculation set this as shipping in 2.34.x, as I believe 2.33 is too far along the dev-cycles. But I also do not see any reason to delay further.
Blocks pantsbuild/scie-pants#541