News for hackers. Stuff that matters.
Re:Ty: A fast Python type checker and LSP by frou_dh on Tuesday December 16, 2025 @05:09PM (#46295289)
Hopefully it gets added to this comparison:

https://htmlpreview.github.io/?https://github.com/python/typ...

If that table is anything to go by, Pyright is not to be underestimated.

I have briefly tried ty (LSP) in Emacs and it seems to work well so far. The only questionable thing I've encountered is that when the signature of a method is shown, the type annotations of some parameters seem to be presented in a particularly verbose form compared to what I'm used to - maybe they're technically correct but it can be bit much to look at.

Anyway, odds are pretty good that ty is what I will end up using long-term, so thanks and congrats on releasing the first beta!

Re:Ty: A fast Python type checker and LSP by hauntsaninja on Tuesday December 16, 2025 @06:42PM (#46296309)
Note: while spec conformance is important, I don't recommend using it as the basis for choosing a type checker. It is not representative of the things that most users actually care about (and is not meant to be).

(I was on the Python Typing Council and helped put together the spec, the conformance test suite, etc)

Re:Ty: A fast Python type checker and LSP by SmileyKeith on Tuesday December 16, 2025 @07:23PM (#46296657)
Can you add some examples of the things users care about that aren't well covered by this? I empathize with everyone who wants a feature comparison chart so they can be confident switching without unknowingly losing important safety checks.
Re:Ty: A fast Python type checker and LSP by dcre on Tuesday December 16, 2025 @07:49PM (#46296855)
I think the idea is not that there are features that aren’t listed, but rather that if a typechecker supports 10 features people care about and is missing 10 that people don’t really use, it will look a lot worse on a list like this than a typechecker with 100% compliance, when in practice it may not really be worse at all.
Re:Ty: A fast Python type checker and LSP by codys on Tuesday December 16, 2025 @07:58PM (#46296914)
The chart does not describe speed (either in general or in any particular case). Speed/performance/latency is a thing users care about that is not included in the feature list.
Re:Ty: A fast Python type checker and LSP by SmileyKeith on Tuesday December 16, 2025 @08:50PM (#46297267)
Yea that one is fine and well covered in the blog post, and pretty easy to spot in light testing. I'm much more worried about the ones that are harder to spot until you have a false negative that turns into a real bug which would be caught by 1 tool and not another.
Re:Ty: A fast Python type checker and LSP by jghn on Wednesday December 17, 2025 @03:45PM (#46305278)
I can't recall a single time that type-checker speed was the limiting factor for me.
Re:Ty: A fast Python type checker and LSP by theLiminator on Thursday December 18, 2025 @02:27AM (#46309859)
I can't say I've been bottlenecked on it, but I've certainly been bothered by it.
Re:Ty: A fast Python type checker and LSP by hauntsaninja on Tuesday December 16, 2025 @09:42PM (#46297631)
The conformance test suite is currently mostly focused on “what does an explicit type annotation mean”

A shared spec for this is important because if you write a Python library, you don’t want to have to write a different set of types for each Python type checker

Here are some things the spec has nothing to say about:

Inference

You don’t want to annotate every expression in your program. Type checkers have a lot of leeway here and this makes a huge difference to what it feels like to use a type checker.

For instance, mypy will complain about the following, but pyright will not (because it infers the types of unannotated collections as having Any):

  x = []
  x.append(1)
  x[0] + "oops"
The spec has nothing to say about this.

Diagnostics

The spec has very little to say about what a type checker should do with all the information it has. Should it complain about unreachable code? Should it complain if you did `if foo` instead of `if foo()` because it’s always true? The line between type checker and linter is murky. Decisions here have nothing to do with “what does this annotation mean”, so are mostly out of scope from the spec.

Configuration

This makes a huge difference when adapting huge codebases to different levels of type checking. Also the defaults really matter, which can be tricky when Python type checkers serve so many different audiences.

Other things the spec doesn’t say anything about: error messages quality, editor integration, speed, long tail of UX issues, implementation of new type system features, plugins, type system extensions or special casing

And then of course there are things we would like to spec but haven’t yet!

Re:Ty: A fast Python type checker and LSP by maleldil on Tuesday December 16, 2025 @11:10PM (#46298150)
> but pyright will not (because it infers the types of unannotated collections as having Any)

This is incorrect. pyright will infer the type of x as list[Unknown].

Re:Ty: A fast Python type checker and LSP by hauntsaninja on Wednesday December 17, 2025 @12:53AM (#46298706)
Unknown has the exact same type system semantics as Any.

Unknown is a pyright specific term for inferred Any that is used as the basis for enabling additional diagnostics prohibiting gradual typing.

Notably, this is quite different from TypeScript’s unknown, which is type safe.

Re:Ty: A fast Python type checker and LSP by ErikBjare on Thursday December 18, 2025 @03:55AM (#46310368)
This was confusing me, thanks.
Re:Ty: A fast Python type checker and LSP by xixixao on Wednesday December 17, 2025 @05:13AM (#46300144)
In case you’re not well versed in Python typecheckers, in the mypy vs Pyright example, Pyright can be configured to complain about not annotating the collection (and so both typecheckers will yell at the code as written).

TypeScript takes the same approach in this scenario, and I assume this helps both be fast.

Re:Ty: A fast Python type checker and LSP by solvedd on Wednesday December 17, 2025 @06:36AM (#46300841)
They were "on the Python Typing Council and helped put together the spec, the conformance test suite, etc" so I assume they are an expert on Python typecheckers
Re:Ty: A fast Python type checker and LSP by xixixao on Wednesday December 17, 2025 @03:51PM (#46305342)
I didn’t write it for parent lol. I guess I should be more careful with “you”.
Re:Ty: A fast Python type checker and LSP by jitl on Wednesday December 17, 2025 @02:15PM (#46304139)
TypeScript will use flow typing to determine the type as number[] in this code:

    const x = []
    x.push(1)
    type t = typeof x // number[]
Re:Ty: A fast Python type checker and LSP by _carljm on Tuesday December 16, 2025 @05:15PM (#46295360)
We'll be adding ourselves to that table soon. We'll have some work to catch up with pyright on conformance, but that's what the time between now and stable release is for.
Re:Ty: A fast Python type checker and LSP by progbits on Tuesday December 16, 2025 @05:36PM (#46295603)
pyright is very good, but there is also https://docs.basedpyright.com/latest/ which improves on it further.

That said I'm very happy user of uv, so once Ty becomes ready enough will be happy to migrate.

Re:Ty: A fast Python type checker and LSP by conception on Tuesday December 16, 2025 @07:28PM (#46296700)
Basedpyright plus any AI generated python is a hellscape unless you use hooks and have a lot of patience.
Re:Ty: A fast Python type checker and LSP by bravura on Tuesday December 16, 2025 @11:40PM (#46298331)
Do you mind elaborating?

And what do you use instead?

Re:Ty: A fast Python type checker and LSP by progbits on Wednesday December 17, 2025 @04:51AM (#46300018)
Not sure where the AI generated python is coming from?

AI generated anything is a hellscape.

Re:Ty: A fast Python type checker and LSP by WD-42 on Tuesday December 16, 2025 @05:55PM (#46295849)
Pyright has been great. But it’s slow. Speed of a LSP does matter for UX. Excited to see how much ty improves on this.
Re:Ty: A fast Python type checker and LSP by morkalork on Tuesday December 16, 2025 @11:22PM (#46298225)
Is it wrong to to say that I don't like pyright on principe because it requires node.js and npm to install and run?
Re:Ty: A fast Python type checker and LSP by cmclaughlin on Tuesday December 16, 2025 @11:47PM (#46298381)
I feel the same way.
Re:Ty: A fast Python type checker and LSP by wiz21c on Wednesday December 17, 2025 @04:01AM (#46299721)
I think it is way to slow too. The one from microsoft (pylance IIRC) is better in my opinion.
Re:Ty: A fast Python type checker and LSP by ameliaquining on Wednesday December 17, 2025 @11:55AM (#46302032)
Pylance's type checker is Pyright, so in that particular respect they're exactly the same.
Re:Ty: A fast Python type checker and LSP by linhns on Wednesday December 17, 2025 @01:19PM (#46303324)
Pyright is a type checker, not a LSP per se in my opinion. ty is both.
Re:Ty: A fast Python type checker and LSP by melodyogonna on Wednesday December 17, 2025 @04:57PM (#46306134)
Pyright is also an lsp, it implements the LSP spec, it is just slow.
Re:Ty: A fast Python type checker and LSP by linhns on Thursday December 18, 2025 @12:45PM (#46315995)
Not that slow tbh, although compared to ty, it’s a snail
Re:Ty: A fast Python type checker and LSP by IshKebab on Tuesday December 16, 2025 @05:26PM (#46295481)
Pyright is really really good. Anyone that doubts that 10x engineers exist, just go and look at Eric Traut. He's pretty much written it single handedly. Absolute machine.

Mypy is trash. Nice to have a table to point to to prove it.

Re:Ty: A fast Python type checker and LSP by buibuibui on Tuesday December 16, 2025 @05:34PM (#46295578)
Oh my, I just looked him up. He is the developer of Virtual Game Station - a PS1 emulator that I used in the past to play PS Isos on my Windows ME PC! What a legend.
Re:Ty: A fast Python type checker and LSP by jimmydoe on Wednesday December 17, 2025 @07:40AM (#46301300)
Wat

Unbelievable

Re:Ty: A fast Python type checker and LSP by davidhalter on Thursday December 18, 2025 @09:06AM (#46312823)
Mypy is not trash at all. It is still the most precise type checker, supports a lot of complicated cases and has plugins that make a lot of things more type safe. I believe Mypy is severely underrated and a lot of people believe that it's not as good as Pyright because of the conformance tests.

The problem is that the conformance tests were mostly written by Eric Traut, so there's a natural bias towards specifying what Pyright does well. There's a lot of things Mypy does really well that should probably be implemented in Pyright.

Re:Ty: A fast Python type checker and LSP by SSchick on Tuesday December 16, 2025 @09:04PM (#46297349)
https://github.com/python/typing/pull/2137

PR is somewhat WIP-ish but I needed some motivation to do OSS work again :)

Re:Ty: A fast Python type checker and LSP by CyberThijs on Wednesday December 17, 2025 @07:47AM (#46301370)
For those interested: the results page in this PR looks like this:

https://htmlpreview.github.io/?https://github.com/SimonSchic...

Re:Ty: A fast Python type checker and LSP by collinmanderson on Wednesday December 17, 2025 @01:07PM (#46303161)
Thanks.

I really need better generics support before ty becomes useful. Currently decorators just make all return types unknown. I need something this to work:

    _F = TypeVar("_F", bound=Callable[..., Any])
    def my_decorator(*args: str) -> Callable[[_F], _F]: ...
Also, I use a lot of TypedDicts and there's not much support yet.