Typhon

Questions about Typhon.

Python compatibility, migration and what to expect during beta. For more detail, see the documentation or open an issue.

What is Typhon?
A typed language for Python developers. You write .ty files and tyc checks them, then compiles them to readable .py files. Typhon adds syntax and stricter rules for types, mutation and error handling.
How is it different from mypy or Pyright?
Those check type hints on ordinary Python and leave the language alone. Typhon adds things Python doesn't have, such as let and mut, T?, Result with ?, sealed unions and gather:. Its rules are enforced by the compiler that writes your Python, so code that fails them never gets built. You can still run Astral's ty over the output with --with-ty.
Do I need a Typhon runtime installed?
No separate runtime package. The build writes ordinary .py files and, for features such as Result, small generated Python helpers alongside them. Deploy that output with your Python dependencies.
Which Python does it need?
CPython 3.13 is the minimum. Since beta.4, tyc init sets target = "3.15" for new projects. Existing projects keep their configured target; omitting target still means 3.13. Targets 3.13, 3.14 and 3.15 are supported, including their free-threaded builds. Set the target in the [python] section of typhon.toml, and run the output on that Python version or newer. Features newer than your target are rejected by the compiler. See the Python target settings.
Can I keep using my libraries?
Yes. tyc reads function signatures from your virtual environment, so a wrong-typed call into a typed library is caught at tyc check. It also follows annotated return types into their classes to check methods and properties, and warns when you use APIs marked deprecated with PEP 702. Generic classes from dependencies no longer need explicit type arguments just to match an annotation of the same class when the dependency's type parameters are unknown. httpx and requests come with stubs built in, and you can write .dty stubs for additional boundaries.
How do I migrate an existing Python codebase?
tyc migrate rewrites typed Python as Typhon, turning Optional[T] into T?, dropping @dataclass and so on, to give you somewhere to start.
Is it stable?
It's in beta. The core syntax listed in the compatibility policy is frozen for the beta line. New checks and deliberate exceptions follow that policy; review the changelog before upgrading.
What does tyc run actually run?
It uses tyc's built-in interpreter when the program is supported. When a program uses something the interpreter does not cover, tyc run builds it and runs it with CPython instead, and reports the fallback. See execution modes and requirements.
Which editors does it work with?
Any editor with Language Server Protocol support, through tyc lsp. There is a reference VS Code extension that currently needs packaging from source; it is not on the Marketplace yet. Follow the editor setup guide.
What licence is it under?
MIT. The source, issues and releases are on GitHub.

Try it on a small project.

Install the compiler, run the starter and explore the language.