Typhon

Good questions. Clear answers.

Not here? The documentation goes deeper, or open an issue.

What is Typhon?
A statically typed, stricter superset of Python. You write .ty files and tyc compiles them to .py. Every Typhon program becomes valid Python, but not every Python program is valid Typhon.
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.
Does anything Typhon-specific run in production?
No. The build writes ordinary .py files. If you use features such as Result, it also writes a small helper module into your project, which you own and can read.
Which Python does it need?
CPython 3.13 or newer to run what it builds. Targeting 3.15 turns lazy import into Python's native lazy imports.
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. httpx and requests come with stubs built in, and you can write .dty stubs for anything else.
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 syntax listed in the compatibility policy won't change during the beta, and new checks only reject code that would already have failed at runtime. The policy lists the few deliberate exceptions.
What does tyc run actually run?
tyc's own interpreter, which starts instantly and doesn't write any files. CI compares its output with CPython's across the example programs. When a program uses something the interpreter doesn't cover, tyc run builds it and runs it with CPython instead, and tells you so.
Which editors does it work with?
Any editor with Language Server Protocol support, through tyc lsp. There is a reference VS Code extension in the repository, not yet on the Marketplace.
What licence is it under?
MIT. The source, issues and releases are on GitHub.

Ready to try it? Install tyc.