Introducing runtime_introspect v0.2.0 !
https://github.com/neutrinoceros/runtime-introspect/releases/tag/v0.2.0
This versions introduces high level, portable APIs like
- FeatureSet.supports("free-threading")
- FeatureSet.supports("JIT")
- FeatureSet.supports("py-limited-api")
making it possible to inspect availability for specific features at runtime with *very* little code (turns out solving this problem in the general case is complicated enough that I only want to do it once).
For instance
from runtime_introspect import runtime_feature_set
fs = runtime_feature_set()
if fs.supports("free-threading"):
... # cool multi-threading stuff
else:
... # less cool, single threading stuff
every non-EOL version of #CPython (including unstable ones, #Python315) are supported.