Skip to content
Typhon language logo

Python, checked before it runs.

A stricter, statically typed superset of Python. Catch mistakes early. Compile to readable CPython.

The 30-second pitch

Every .ty file emits valid, idiomatic .py. Not all .py is valid Typhon.

Typhon is what Python could look like if you started over with three decades of language-design hindsight, while still keeping every Python library you love. It is a compile-to-Python language in the same sense that TypeScript is a compile-to-JavaScript language: you write the stricter, safer, more ergonomic dialect, and the compiler hands you idiomatic CPython that runs everywhere Python runs — no Typhon runtime, no PyPI dependency, no special interpreter.

type LoadError = NotFound | Timeout
class NotFound:
path: str
class Timeout:
after_ms: int
def load(path: str) -> Result[str, LoadError]:
try:
with open(path) as f:
return Ok(f.read())
except FileNotFoundError:
return Err(NotFound(path=path))
def main() -> None:
match load("config.toml"):
case Ok(body):
print(body)
case Err(NotFound(path)):
print(f"missing: {path}")
case Err(Timeout(after_ms)):
print(f"timed out after {after_ms}ms")

The match on LoadError is statically exhaustive — add a third variant to the union and every match site goes red until you handle it. That is, in one screenshot, the kind of safety Typhon brings to Python.

What you get

Non-nullable by default

Plain T cannot hold None. Use T? when you mean optional. Flow narrowing on is None, is not None, isinstance, guard, and early returns.

No implicit Any

Untyped values are a hard error outside unsafe: blocks. The strictness is stronger than TypeScript’s noImplicitAny.

Errors as values

Result[T, E], Ok, Err, and the ? operator make failure visible in signatures — without giving up Python’s exception bridge.

Sealed unions + exhaustive match

type Shape = Circle | Rectangle | Triangle. Add a variant; every match lights up red. Refactor with confidence.

Explicit async, smarter concurrency

gather: lowers to asyncio.TaskGroup (the safe default). go f(x) spawns fire-and-forget through a strong-ref registry. No GC’d tasks.

Build-time configuration

comptime let PORT: int = int(env("PORT", "8080")) inlines at build time. Missing required env vars fail the build, not production.

Clean output, no runtime tax

Emits idiomatic Python you can read, debug, and ship. The handful of helpers (Result, lazy, task registry) is generated locally as typhon_runtime/. No PyPI install.

One binary, full pipeline

tyc is the compiler, formatter, language server, REPL, in-process VM, migrator, debugger launcher, and package-manager surface — sub-100ms incremental feedback via Salsa.

Start here

Status

The current release is v1.0.0-beta.2, the first published beta. Typhon reached its first feature-complete alpha in v1.0.0-alpha — the proven production surface plus the type-system frontier earlier releases deferred (higher-kinded type unification, user-generic variance inference, the inter-procedural field-init audit). The alpha.2 → alpha.9 point releases that followed were a soundness, robustness, performance, release-engineering, and codebase-review hardening pass, and beta.1 closes four review-remediation waves and freezes the surface under the compatibility policy.

  • The production path is stable. tyc build → CPython 3.13+ carries no runtime dependency on the toolchain; the full example corpus builds to runnable Python and checks clean.
  • The language is additive on correct programs across the whole v0.3.0 → v1.0.0-alpha line — every program that type-checked and ran correctly continues to behave identically.
  • The surface is frozen for the beta line. The forms listed in the compatibility policy keep their syntax and meaning in every beta release; the policy also lists beta.1’s deliberate exceptions, chiefly [strictness] nullable-use now defaulting to "error".
  • Still deferred: embedded in-process ty (the subprocess [checker] external = "ty" path ships), typeshed-backed checking for pure-extension libraries, and the function-level HKT tail.

For the full breakdown see Project Status; for the release-by-release history see the changelog.

Typhon targets CPython 3.13+ (and the free-threaded 3.13t/3.14t builds when you opt in). It is not a new runtime, not a Mojo-style separate language, and not a replacement for the Python you already write. It is the language you reach for when you want Python’s libraries with Rust-flavoured static safety and ergonomics.