Python, checked before it runs.
A typed language for Python developers. Make optional values and errors explicit, then compile to readable Python.
.tytyc.py· macOS, Linux and Windows
def main() -> None:
let user: str? = find_user(1)
greet(user)This value might be None.
greet expects a str. Typhon catches the mismatch before you run the program.
9 greet(user)
^^^^Guard the value to narrow its type.curl -fsSL https://typhon.sh/install.sh | shA little stricter. A lot clearer.
Say what your code means.
Explicit bindings, complete matches and errors you can handle.
Make change deliberate.
Use let for fixed bindings and mut for reassignment. Make your intent clear to the next reader.
Explicit bindingslet limit: int = 3
mut attempts: int = 0
attempts += 1
print(attempts < limit)Handle every possibility.
Add a sealed-union variant, and Typhon points out every match that needs an update.
Exhaustive matchingdef area(shape: Shape) -> float:
match shape:
case Circle(radius):
return 3.14 * radius * radius
case Square(side):
return side * sideMake failures visible.
Result puts errors in the function signature. Propagate them with ? and keep the successful path clear.
Errors as valuesdef calculate() -> Result[int, str]:
let value: int = divide(10, 2)?
return Ok(value * 2)Familiar on the other side.
What you ship is Python.
Typed fields become a Python dataclass. Build to readable CPython 3.13+ output, with source maps back to your original code.
main.tyYour sourcetycCheck + compilemain.pyPlain Pythonclass User:
name: str
enabled: bool = True@dataclasses.dataclass(slots=True)
class User:
name: str
enabled: bool = TrueDeploy on CPython with your Python dependencies. Features such as Result generate small helpers in your build output; no separate Typhon runtime package is needed.
See concurrency and error handling in PythonFrom first file to everyday work.
Your editor.
One toolchain.
The compiler, formatter, language server and REPL live in tyc. Get diagnostics, hover and completion in an editor with LSP support.
The VS Code extension needs packaging from source. Follow the setup guide.
1 let limit: int = 3
2 limit = 4let bindings cannot be reassigned. Use mut when the value should change.
Illustrative compiler diagnostic.
Start small.
Try it on code you want to trust.
Use Typhon when you want explicit types and failure handling, and are ready to write .ty source. Start with a small project; review the beta compatibility policy before adopting it.
tyc init hello
cd hello
tyc check src/
tyc run
tyc build- How is this different from Pyright?
- Typhon adds language features and enforces its rules as it compiles. It writes the Python you deploy.
- Can I use my existing Python libraries?
- Yes. Typhon reads typed library signatures from your environment and follows annotated return types to check methods and properties.
- Can I migrate existing code?
tyc migrateconverts typed Python into Typhon as a starting point.- Is Typhon ready for me?
- Typhon is in beta. Read the compatibility policy before adopting it.
Write Python with fewer surprises.
Start with a single binary. Build readable Python.