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
.tyfiles andtyccompiles 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
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. - Does anything Typhon-specific run in production?
- No. The build writes ordinary
.pyfiles. If you use features such asResult, 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 importinto Python's native lazy imports. - 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. httpx and requests come with stubs built in, and you can write.dtystubs for anything else. - 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 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 runbuilds 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.