[python]
[python]target = "3.13"free-threaded = false| Key | Type | Default | Description |
|---|---|---|---|
target | "3.13" | "3.13t" | "3.14" | "3.14t" | "3.15" | "3.15t" | "3.13" | Target CPython version. Drives syntax choices and a few lowering decisions. The t suffix selects free-threaded emission paths — see free-threaded below. A 3.15+ target additionally unlocks native PEP 810 lazy-import lowering — see lazy. |
free-threaded | bool | false | Allow emit paths that use threads for parallelism (requires 3.13t/3.14t/3.15t). Default false until 3.14 ships as the default Python. free-threaded = true with a target lacking the t suffix is accepted — it only switches on advice lints — but tyc check / tyc build warn that a GIL build cannot benefit. |
Targets
"3.13"— default. Supports PEP 695 generics natively. Most projects."3.14"— same, plus 3.14 syntax: t-strings and unparenthesisedexcept A, B:."3.15"— same, plus native PEP 810 lowering forlazy import: the emitter drops thetyphon_runtimeproxy-class helper entirely and emits the nativelazy import MODULE as ALIASstatement instead. A project whose only runtime-touching feature waslazy importships no generatedtyphon_runtime/package at all on this target.3.13/3.14output is unaffected — byte-for-byte unchanged. A 3.15 target also unlocks unpacking comprehensions ([*xs for xs in lists],{**d for d in ds}) and thefrozendictandsentinelbuiltins.
Syntax and builtins newer than the target are rejected with tyc::requires_newer_python, since the emitted .py could not compile or run there. Stdlib imports are vetted against the target as well: import sre_parse warns on 3.15, where the module was removed.
Older targets ("3.12", "3.11") are not supported in v1 — they would need a PEP 695 → TypeVar rewrite that we haven’t built.
free-threaded = true
Opts into the threading-based parallelism emit paths:
goalways lowers throughtyphon_runtime.tasks.spawn(anasynciotask held in a strong-ref registry) — there is noThreadPoolExecutorlowering forgo, including on free-threaded builds.- The analyser may emit a thread-pool (or, with
parallel-backend = "interpreters", a PEP 734 sub-interpreter pool) map for pure-function comprehensions over large collections ([strictness] auto-parallel) — including comprehensions with a pure filter, extra invariant call arguments, or nested pure calls — and, with[strictness] auto-parallel-reductions,int-only accumulator loops (for x in xs: total += f(x)). - Every emitted parallel block first checks
sys._is_gil_enabled()and falls back to sequential if a GIL build is detected. - Two advice-only lints nudge free-threaded projects toward the above:
tyc::parallel_opportunity(a parallelisable loop whose enabling knob is off) andtyc::shared_mut_across_tasks(ago-spawned function racing on shared module state). Both gated by[strictness] suggest-parallel(defaulttrue) and both silent unlessfree-threaded = true.
Requires the special python3.13t / python3.14t / python3.15t interpreter build. On a stock GIL build, the runtime fallback keeps the code correct (sequential execution).
See async, await, gather, go for the full parallelism surface, and [strictness] for every knob.
Default off until 3.14 ships as the default Python.