Environment marker for free-threading

I think it would make sense to essentially expand sys.abiflags into a list with proper feature/variant names, which could live in sys or sysconfig. The marker, then, would be something like 'free-threading' in sysconfig.abi_features.

Technically, we could do 't' in sys.abiflags, but we could really use proper standardized names for ABI flags — no more is it “free-threading” or “nogil”? — so we might as well take the opportunity to add this API.

Backwards compatibility wouldn’t be much of an issue, on older versions, we just translate sys.abiflags to the names chosen in the new API.

I think that’s a bundle of complexity on its own, I wonder if it wouldn’t be better off as a separate PEP.

That said, I really like the idea. We implemented something similar in Conda. Here, for example, the CUDA version is implemented as a plugin. In this case, a first-party one, but 3rd parties could do the same.

2 Likes