Live data from Hacker News

Ty: A fast Python type checker and language server

github.com

61–70 of 296 posts

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

#61
post #19

Earlier quoted context omitted.

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

how does it compare against mypy? is it much faster?

How does it compare against Pyright. Pyright is the gold standard of Python type checking currently. Mypy is slower and buggier.

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

#62
post #47

Does it support go to definition and other lsp features?

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.

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

#63

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…

>The way these type checkers get fast is usually by not supporting the crazy rich reality of realworld python code. Nah, that's just part of the parade of excuses that comes out any time existing software solutions get smoked by a newcomer in performance, or when existing software gets more slow and bloated. Here's one of many examples: https://m.youtube.com/watch?v=GC-0tCy4P1U&pp=0gcJCdgAo7VqN5t...

Sure, but so far this has been a true criticism of every python type checker that isnt mypy that is production ready today

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

#64

Earlier quoted context omitted.

how does it compare against mypy? is it much faster?

How does it compare against Pyright . Pyright is the gold standard of Python type checking currently. Mypy is slower and buggier.

Mypy is also able to check things that are inexpressible with stubs, among other things

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

#66

Earlier quoted context omitted.

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.

Not supporting plugins for a type checker to me is a plus. It’s quite frustrating that some Python projects only typecheck if you have plugins. That is a major source of frustration.

I mean that kind of code exists; things like attrs are too magical otherwise

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

#67

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.

Charlie already said in a podcast (https://www.youtube.com/watch?v=XVwpL_cAvrw) that they are not looking to make it extensible. That it's considered a feature that type checking works interchangeably across tools and projects.

Ruff's linting and formatting is more likely to get plugin/extension support at some point in the future.

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

#68

Earlier quoted context omitted.

For pre-alpha software it's working fantastic for my project. I thought I type annotated it well, but Ty had quite a lot of feedback for me. Great job and I can't wait until this is released.

Had you checked it with Pyright previously?

I've only used Pylance standard type checking in vscode. I have not used pyright as a stand alone package.

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

#69

Very excited to have a new fully featured Python language server working in both vscode and vscode forks (e.g. Windsurf, Cursor). Pylance is borked on these forked distributions, so having a new solid alternative here that doesn't involve adopting yet another forked Pyright implementation (BasedPyright, Cursor Pyright, Windsurf Pyright, ...) sounds great to me.

You should try basedpyright: https://docs.basedpyright.com/latest/

> basedpyright re-implements many features exclusive to pylance - microsoft's closed-source extension that can't be used outside of vscode.

Post reply on HN