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.
Write
.ty, check it withtyc, and deploy readable.py.
Write .ty source with explicit types, bindings and error handling. tyc checks it and compiles it to readable Python for CPython 3.13 or newer. Use your Python dependencies through typed signatures and stubs. You do not install the compiler or a separate Typhon runtime package in production; features such as Result generate small Python helpers inside the build output.
type LoadError = NotFound | Timeout
class NotFound: path: strclass 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")from dataclasses import dataclassfrom typhon_runtime import Ok, Err
@dataclass(slots=True)class NotFound: path: str
@dataclass(slots=True)class Timeout: after_ms: int
LoadError = NotFound | Timeout
def load(path: str) -> Ok[str] | Err[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 Typhon identifies matches that need to handle it.
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.
Readable Python output
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 includes the compiler, formatter, language server, REPL, in-process interpreter, migrator, debugger launcher and package-manager commands.
The current release is v1.0.0-beta.7, which fixes a generic-annotation false positive on dependency classes, orders the generated __all__ for ruff, and documents committing the build manifest, on top of v1.0.0-beta.6 (checks on what a third-party function returns, including @deprecated APIs and properties) and v1.0.0-beta.5’s third-party checking and build fixes.
tyc build writes Python and any required generated helpers. Deploy it with your application’s Python dependencies; the compiler is not needed in production.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 supports CPython 3.13, 3.14 and 3.15 targets, including their free-threaded builds. The default is 3.13. Configure the Python target to enable newer syntax and builtins; the compiler rejects features newer than the selected target.