Live data from Hacker News

Ty: A fast Python type checker and language server

github.com

11–20 of 296 posts

Re: Ty: A fast Python type checker and language server

#11

Interesting to see astral come out with this right around facebook’s release of “Pyrefly, a faster Python type checker written in Rust”. Not making any sort of ethical statement, just interesting that rust keeps eating the python and JS tooling worlds.

Astral announced it last year I think, so it's been a long time coming.

Re: Ty: A fast Python type checker and language server

#12

Interesting to see astral come out with this right around facebook’s release of “Pyrefly, a faster Python type checker written in Rust”. Not making any sort of ethical statement, just interesting that rust keeps eating the python and JS tooling worlds.

Also interesting, pyrefly uses Ruff’s parser!

https://github.com/facebook/pyrefly/blob/a8626110da034f8e513...

Re: Ty: A fast Python type checker and language server

#14
Fingers crossed this is/becomes extensible. Pyright and MyPy both suffer from lack of extensibility IMO (Pyright doesn't consider the use case and MyPy plugins come across as an afterthought with limited capabilities). There are many things that can be built on the back of type-checked AST.

Re: Ty: A fast Python type checker and language server

#16

Interesting to see astral come out with this right around facebook’s release of “Pyrefly, a faster Python type checker written in Rust”. Not making any sort of ethical statement, just interesting that rust keeps eating the python and JS tooling worlds.

Pyrefly is a rewrite of Pyre, a Python typechecker which has been around for 4-5 years. Pyre is the strictest type checker I've used, compared to mypy, but its kind of a pain to set up.

Re: Ty: A fast Python type checker and language server

#17
post #2

Just compared the time to check on a fairly large project: - mypy (warm cache) 18s - ty: 0.5s (and found 3500 errors) They've done it again.

> They’ve done it again.

Indeed they have. Similar improvement in performance on my side.

It is so fast that I thought it must have failed and not actually checked my whole project.

Re: Ty: A fast Python type checker and language server

#18

Fingers crossed this is/becomes extensible. Pyright and MyPy both suffer from lack of extensibility IMO (Pyright doesn't consider the use case and MyPy plugins come across as an afterthought with limited capabilities). There are many things that can be built on the back of type-checked AST.

I’ve had this same thought. Ruff doesn’t support extensions / custom lint rules that I’m aware of, so maybe don’t get your hopes up.

Re: Ty: A fast Python type checker and language server

#19

If you have uv installed, you can test it without installing by running: uvx ty check

Here's what I got against one of my larger open source projects:

  cd /tmp
  git clone https://github.com/simonw/sqlite-utils
  cd sqlite-utils
  uvx ty check
Here's the output: https://gist.github.com/simonw/a13e1720b03e23783ae668eca7f6f...

Adding "time uvx ty check" shows it took:

  uvx ty check  0.18s user 0.07s system 228% cpu 0.109 total

Re: Ty: A fast Python type checker and language server

#20
The way these type checkers get fast is usually by not supporting the crazy rich reality of realworld python code.

The reason we're stuck on mypy at work is because it's the only type checker that has a plugin for Django that properly manages to type check its crazy runtime generated methods.

I wish more python tooling took the TS approach of "what's in the wild IS the language", as opposed to a "we only typecheck the constructs we think you SHOULD be using".

Post reply on HN