Typhon
v1.0.0-beta.7 · Sharper dependency checks

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

tyc 1.0.0-beta.7
src/main.ty · excerpt
def main() -> None:
    let user: str? = find_user(1)
    greet(user)
$ tyc check src/
tyc::nullable_use

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.
Guided example: a nullable value needs a guard.Verified with tyc 1.0.0-beta.7
One command to get started.
curl -fsSL https://typhon.sh/install.sh | sh
Scroll sideways if needed. Copy includes the full command.

A little stricter. A lot clearer.

Say what your code means.

Explicit bindings, complete matches and errors you can handle.

01

Make change deliberate.

Use let for fixed bindings and mut for reassignment. Make your intent clear to the next reader.

Explicit bindings
Explicit bindings
let limit: int = 3
mut attempts: int = 0
attempts += 1
print(attempts < limit)
View complete example
02

Handle every possibility.

Add a sealed-union variant, and Typhon points out every match that needs an update.

Exhaustive matching
Exhaustive matching · excerpt
def area(shape: Shape) -> float:
    match shape:
        case Circle(radius):
            return 3.14 * radius * radius
        case Square(side):
            return side * side
View complete example
03

Make failures visible.

Result puts errors in the function signature. Propagate them with ? and keep the successful path clear.

Errors as values
Errors as values · excerpt
def calculate() -> Result[int, str]:
    let value: int = divide(10, 2)?
    return Ok(value * 2)
View complete example

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 Python
src/main.ty · complete source
class User:
    name: str
    enabled: bool = True
build/main.py · emitted excerpt
@dataclasses.dataclass(slots=True)
class User:
    name: str
    enabled: bool = True

Deploy 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 Python

From 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.

main.tyTyphon diagnostics
1 let limit: int = 3
2 limit = 4
immutable_assign

let 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.

Compare with mypy and Pyright
Your first project · shell or PowerShell
tyc init hello
cd hello
tyc check src/
tyc run
tyc build

Before you start.

A few good questions.

All questions
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 migrate converts 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.