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
.tyfiles andtycchecks them, then compiles them to readable.pyfiles. 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
letandmut,T?,Resultwith?, sealed unions andgather:. Its rules are enforced by the compiler that writes your Python, so code that fails them never gets built. You can still run Astral'styover the output with--with-ty. - Do I need a Typhon runtime installed?
- No separate runtime package. The build writes ordinary
.pyfiles and, for features such asResult, 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 initsetstarget = "3.15"for new projects. Existing projects keep their configured target; omittingtargetstill 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 oftyphon.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.
tycreads function signatures from your virtual environment, so a wrong-typed call into a typed library is caught attyc 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.dtystubs for additional boundaries. - How do I migrate an existing Python codebase?
tyc migraterewrites typed Python as Typhon, turningOptional[T]intoT?, dropping@dataclassand 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 runbuilds 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.