Live data from Hacker News

Ty: A fast Python type checker and language server

github.com

131–140 of 296 posts

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

#131

prior to astral appearing, python's tooling has been beyond terrible, compared to say, Java's astral have now replaced the awful pip with the fantastic uv various awful linters with with the fantastic ruff and now hopefully replacing the terrible type checkers (e.g. mypy) with a good one! I hope they have the pypi backend on their list too, my kingdom for Maven Central in python!

Even after all the praise, I'd say they're underrated.

Modular.ai raised $100 million to solve tangentially similar problems with python. Astral has already had a much larger impact, while providing better integration with less than 10% of that money.

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

#132
post #41

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 th…

> I wish more python tooling And not directly related, but I wish more python modules did proper checks with Valgrind before shipping.

The CPython API is such a dumpster fire, even writing very simple modules the reference counting is very difficult to do correctly. The majority of python modules written in C are probably leaking memory somewhere but nobody knows.

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

#133
I've been looking forward to this since the original announcement (and before, really).

On the modest codebase I tried it on (14k LOC across 126 files), it runs in 149ms compared to 1.66s in pyright (both run via uvx ). I couldn't get it to play nicely with a poetry project, but it works fine (obviously) in a uv project.

Definitely some false-positives, as expected. Interestingly, it seems to hate the `dict()` initializer (e.g. `dict(foo="bar")`).

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

#134
post #27

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 th…

In defense of mypy et al, Typescript had some of the greatest minds of our generation working for a decade+ on properly typing every insane form found in every random Javascript file. Microsoft has funded a team of great developers to hammer away at every obscure edge case imaginable. No other python checker can compare to the resources that TS had.

It's not mypy issue. Comparing to TS python typehints (spec wise) are a joke. It's started as bolted on adhoc solution and evolved quite chaotically. For example [1]. TS doesn't require a special decorator (sic!) to make your custom classes to be picked up by type checkers.

Or how make a wrapper function with args and kwargs to pass through?

[1]: https://docs.python.org/3/library/typing.html#typing.datacla...

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

#135

Earlier quoted context omitted.

The VS Code extension is linked in one of the above comments. Accepting that it’s early days and all, but … if someone _really_ hated Pylance, could they replace it with ty for hobby projects and get most of the same headline functionality? Thanks for all your great work! Love ruff, rye/uv.

Not the same headline functionality yet, no. At the moment all we support is diagnostics (some of which may be wrong) and go-to-type-definition. More will come.

Thanks for the indulgence. My question was unreasonable, upon reflection, in light of the other information you’ve already provided in the thread.

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

#136
post #25

Have these guys figured out how to make money yet?

If they're making our lives better, perhaps the question is whether we've figured out how to pay them yet.

From my experience it's VERY rare for people to pay for anything unless they're forced, I do the same thing even though I'm very aware of the need for compensating creators.

Talk is cheap, and people talk a lot about supporting projects.

Maybe if we could make some kind of statistics over the number of projects that were abandoned because maintainers didn't feel like working and dealing with random people for free anymore. Make the consequences of freeloading visible somehow.

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

#137

Earlier quoted context omitted.

We do plan to provide an LSP server and VS Code plugin, which will support GTD etc. Though as several others have pointed out (e.g. https://news.ycombinator.com/item?id=43919354 ), it's still very early days for ty, so we don't have concrete release announcements for that yet.

The VS Code extension is linked in one of the above comments. Accepting that it’s early days and all, but … if someone _really_ hated Pylance, could they replace it with ty for hobby projects and get most of the same headline functionality? Thanks for all your great work! Love ruff, rye/uv.

Depending on the reason you hate Pylance, you could try basedpyright instead https://docs.basedpyright.com/v1.18.4/installation/ides/

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

#140

Recently I started a python project and I wanted to do it the "proper" way. mypy + pylint. But even on this small 15-20kloc program these tools are way to slow to do anything in realtime. It takes double digit seconds to have feedback. Way to long for an LSP. I'm honestly appalled the state of affairs is this bad. What the hell do people do with moderately or even large sized code bases?

They probably use (based)pyright which is much faster than mypy and ruff which is much much much faster than pylint.
Post reply on HN