Live data from Hacker News

Ty: A fast Python type checker and language server

github.com

281–290 of 296 posts

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

#281

Not the most fun question, but as I see Astral taking over the python ecosystem, I can't help but wonder: how do y'all plan to make money? It seems like you've taken VC funding, so monetization is inevitable.

The plan remains the same as when the company was announced (https://astral.sh/blog/announcing-astral-the-company-behind-...) — paid services that build on and integrate with the free tooling.

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

#282
post #174

Earlier quoted context omitted.

mypy is compiled using mypyc. It does not run as Python code.

The semantics of Python makes it problematic to run at speed, it is not just about interpreted vs compiled code. Give the high levels of dynamic behaviors that are allowed, a Jit (like pypy) has a higher chance of getting decent performance if the code has an underlying behavior that can be extracted.

mypy is also written in a style conducive to speed ups when compiling with mypyc

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

#283
post #213

Earlier quoted context omitted.

This argument doesn't make a whole lot of sense because nothing about type annotations constrains Python code at all. In fact because they're designed to be introspectable they make Python even more dynamic and you can do even crazier stuff than you could before. Type checkers are working very hard to handle the weird code. Pydantic being so fast because it's written in Rust is a good thing, you can do crazy dynamic…

> nothing about type annotations constrains Python code at all Sorry, but this is just not true. Don't get me wrong, I write typed Python 99% of the time (pyright in strict mode, to be precise), but you can't type check every possible construct in the language. By choosing to write typed Python, you're limiting how much of the language you can use. I don't think that's a bad thing, but it can be a problem for untyped…

It is literally true. You don't need to run a type checker.

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

#284

Earlier quoted context omitted.

I agree that would be nice; probably not near the top of our list right now (and not trivial to implement), but it makes sense. Thanks for the suggestion.

Nontrivial way to do it is dynamically scan the python 3.12 namespace, and add these warnings. Is there any big downside to do it the boring way, hardcode a list and compare the error to the list?

This information is already maintained via `if sys.version_info >= (...):` conditionals in typeshed stubs. I don't think this is important enough to justify maintaining the same information in a duplicate way.

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

#285

Earlier quoted context omitted.

How is it condescending in any way? I found it to be a constructive criticism; i.e. useful help.

I don't necessarily read it as condescending, but I do read it as presumptuous. What someone "should" do depends on many things. Maybe, because this is software in alpha stage, they should _not_ focus on this part of the code if it is minor compared to other obligations. Or maybe there are other reasons they've chosen not to do this (as was explained in an above comment). IMO, a less presumptuous criticism would be p…

I see what you mean. Perhaps it was just a "poor" choice of words for whatever reasons. I am sure we can assume he intended it in a way of "have you considered X?".

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

#287
post #165
post #3

Earlier quoted context omitted.

Great, but how does it compare to Pyright on the utility / performance curve? Pyright is mature and already very fast. https://github.com/microsoft/pyright

I don't get why so many people go to bat for pyright, my experience with it has been pretty miserable. Open enough instances of it and you're in OOM city. It works, but often gets confused... and of course the absolute audacity of MSFT to say "let's go over to pyright, and by the way we're going to carve up some stuff and put it into pylance instead", meaning that it's totally not within the actual spirit of open sou…

I tried all the type checkers available as of ~1 year ago, and Pyright worked the best for me. It's not perfect, but it's better than any of the pure Python checkers. Memory is cheap (unless you're buying it from Apple I guess...). Would I take a faster type checker with better memory footprint? Heck yes, assuming equal or superior functionality.

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

#288
post #144

Earlier quoted context omitted.

I tested it side-by-side on my ~100Kloc codebase. Ty: 2.5 seconds, 1599 diagnostics, almost all of which are false positives Pyright: 13.6 seconds, 10 errors, all of which are actually real errors There's plenty of potential here, but Ty's type inference is just not as sophisticated as Pyright's at this time. That's not surprising given it hasn't even been released yet. Whether Ty will still perform so much faster on…

Compilation / type checking depends on a lot of trees of typed data, and operating on those tree nodes. That's something where a statically typed language with custom data structures that allows for optimised representations makes a big difference, and where a lot of the fancy optimisations in v8 don't work so well. There is a reason Typescript moved to a typed language.

Let's hope you're right and that translates to even higher performance for Ty compared to Pyright. There are of course many variables and gotchas with these sorts of things.

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

#289
post #44

Curious why so many people want to implement type checkers for python? What problems are being solved that aren't covered already?

Existing python typecheckers are bad, slow and their communities are fragmented. If the community would agree on a single good and fast type checker, everyone will benefit.

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

#290
post #165

Earlier quoted context omitted.

I don't get why so many people go to bat for pyright, my experience with it has been pretty miserable. Open enough instances of it and you're in OOM city. It works, but often gets confused... and of course the absolute audacity of MSFT to say "let's go over to pyright, and by the way we're going to carve up some stuff and put it into pylance instead", meaning that it's totally not within the actual spirit of open sou…

If you haven’t checked it out already, basedpyright is pyright with all the arbitrarily carved out functionality put back in – plus some extra features that you may or may not find useful depending on how strict you like your typing. Can’t recommend it enough

To be honest I can't respect a project that names itself like that. I am a working professional.
Post reply on HN