I remember re-evaluating in March and switching (from mypy or nothing depending on the projects) to pyright<p>At the time, ty had a conformance suite pass rate of 53% and pyrefly of 88% vs. pyright's 98% (and I didn't know zuban)<p>Now [1] pyrefly and zuban both sit at 100%, ty at 97% and pyright at 96%<p>Time to re-evalute<p>[1] <a href="https://github.com/python/typing/blob/main/conformance/results/results.html" rel="nofollow">https://github.com/python/typing/blob/main/conformance/resul...</a>
<a href="https://htmlpreview.github.io/?https://github.com/python/typing/blob/main/conformance/results/results.html" rel="nofollow">https://htmlpreview.github.io/?https://github.com/python/typ...</a> (just to not read raw html)
How does mypy score so low? Isn't it the reference implementation?
I'm not sure how meaningful this conformance suite is given that ty doesn't properly handle `finally` but I can't see that on there.
All the people asking for django type checking: there is no free lunch. You have to change how you write Django to be type friendly. Applies to sqlalchemy/sqlmodel too.<p><a href="https://github.com/adsharma/fquery/blob/main/tests/django_example_model.py" rel="nofollow">https://github.com/adsharma/fquery/blob/main/tests/django_ex...</a><p><a href="https://github.com/adsharma/fastapi-shopping/blob/main/src/fastapi_shopping/models.py" rel="nofollow">https://github.com/adsharma/fastapi-shopping/blob/main/src/f...</a>
Your premise is not true IMO, you can totally get "correct" type checking on fields (including things like "write a string to a field, but normalize to an int and get int, things that Pydantic do not give you!)<p><a href="https://gist.github.com/rtpg/ac1950e6c390ddd7a02ddc941ee75c5f" rel="nofollow">https://gist.github.com/rtpg/ac1950e6c390ddd7a02ddc941ee75c5...</a><p>I beg everyone thinking of writing an ORM or a validation framework to look at my gist and internalize it. You don't need top-level type annotations to get type checking form mypy and friends!<p>People's first idea when trying to tackle types in Python is "OK I want this field to be an int so I will have an API that labels it an int" but if you lean into descriptors you will get a much more flexible system that can handle more scenarios.<p>Being able to distinguish "types that can be written to a field" from "types that are read from a field" in particular are _so straightforward_ all things considered.<p>This doesn't solve a lot of the reverse relation issues and annotations on querysets but neither does your library.
PEP 681 is taking care of that.<p>Despite the name containing dataclass, it can work for Django.<p>Theorically, you can now do this: <a href="https://www.pystebin.com/p/06b0fd4e-e84c-7099-8000-09197d731613/?python=3.14&wrap=0&linenum=1" rel="nofollow">https://www.pystebin.com/p/06b0fd4e-e84c-7099-8000-09197d731...</a><p>Django does not use it right now, and we are limited to using stubs. They do work pretty well.<p>But what I mean is, it's not limited by Python type design anymore.
And for Pydantic models and higher performance: <a href="https://github.com/ebrake/sway-orm" rel="nofollow">https://github.com/ebrake/sway-orm</a>
Nice. The main difference in thinking is that existing python ORMs use implementation inheritance (Model/BaseModel).<p>I've argued with pydantic, sqlmodel and Django people that they should replace them with decorators instead.<p>This will primarily help with automatic translation to Rust.
I'm excited for this as I think Ty is quite nice to use, but this announcement was hard to appreciate because it feels poorly written.<p>They have benchmark graphs which aren't properly labeled; the links (when they exist below) do not give a more full picture (you just have to jump back and forth and try to map the table to the graphs somehow?); and the year-over-year growth chart feels weird. The YoY chart makes me want to know more about why mypy grew 4x from 2025 to 2026 than it makes me feel like Ty has healthy growth. It also is concerning why they chose to emphasize growth of the user base over the actual type checking advantages that Ty gives: especially the advancements 1.0 gives.<p>It's a mishmash of information and feels lacking.
Regarding mypy growth, overall downloads of packages from PyPI has increased ~5x in the last 2 years, which explains part of the change, but it appears usage of type checkers is growing faster than that, which is an interesting trend.<p>A healthy ecosystem around a tool is important, especially a type checker since you want library authors to prioritize a good experience for your tool of choice. It is noteworthy here that ty adoption has grown significantly beyond the rates of other tools.
Everyone coming from statically typed languages trying to build full-blown applications using Python pretty quickly figures out how to get static type checking in Python.<p>`mypy` has caught missed pieces of refactors that were simply never checked anywhere else. It’s found confusing type declarations and outright logic errors, way more than I thought it would in an otherwise well-structured and heavily annotated code base.
A codebase which is heavily annotated but not checked is not going to do much, it has some documentary value but that only goes so far, and in my experience editors will pretty quickly fallback to Any if they do anything at all.
What's wrong with the labels on the benchmarks specifically?<p>(I am on the team and can look into improving them if something can be clearer)
Curious to see how Ty now compares to Pyrefly in practice. Had to switch from Ty because it was rather poor compared to Pyrefly at the time. A bit spoiled for choice in regards to Python type checkers now.
Hah. I just switched from Ty to Pyrefly last night. Like 15 hours ago. I guess it was a good exercise, but now I want to compare this release.
Would be happy to know where we could do better, if you do this comparison on your codebase today. GH issues are open!
For a long time, ty fell back to Any and `x | Unknown` all over every code base I tried, especially for non type hinted functions and attributes, even when they had constrained types, which just propagates into noise and bad hints all over. Ty also doesn't respect any forms of """ comment docs as far as I can tell, so you lose all attempts to attach documentation to function args. Mypy, pylance, and pyrefly (when turned up) all handle these gracefully.
I did exactly the same thing. Nothing against the performance but too much errors in my VS code IDE. But it was 0.xx at that time and I am not sure whether situation has got any better in 1.0
> at the time<p>Any indication of when that was? Just being curious.
I’ve tried it in Spring of 2026. Pyrefly + its VSCode extension just worked, while ty either straight up didn’t work at all or caught nothing.
I think I switched to Pyrefly in very early 2026? I can't remember.
> A bit spoiled for choice in regards to Python type checkers now.<p>"Spoiled" is not the word I'd use. In my admittedly brief experience all the Python type checkers are terrible in practice, and the problem is Python. You know in which languages type checkers work? Elm, Gleam, Haskell, etc. There's usually one type checker and it works – there's no need to create several competing-but-all-broken-in-various-ways type checkers.
I’ve given up on typing in Python in the work codebase. My colleagues don’t care about types, use meta programming too much (too many type-changing decorators and meta classes, etc), and I’ve seen as much as 2000 false positives per 10k loc.<p>But even then, when I switched from pyright to ty, I was really amazed at how fast operations like go-to-definition can be. With pyright, the language-server-based go-to-definition is often slower than ripgrep search.
The biggest advantage of my coworkers on a small team fully writing code with AI now is that I can just add whatever guidelines I like to the monorepo AGENTS.md and their code will automatically respect it. I added instructions to write fully typed code and the codebase became much better.
I just spent a week doing a medium sized python project with Claude, and purposefully didn't give it much of a pointer on style out of curiosity. Really very impressed with the code quality, and everything is well typed. I did declare up front to use ty, maybe that nudged it in the direction.
Can't apply a technical fix to a social problem. Rigor mismatch, I've found, bus just a personality clash that doesn't get better over time.
I've been in your situation. It's difficult to convince people who have never used static types that it's worth it. Especially in a codebase that didn't use them from the start because it's easily 3x more work to add them after the fact. At least pre-AI. These days you can probably just say "Claude, add type annotations everywhere" and I imagine it would do a pretty perfect job.
In my experience people will sooner write their Slack posts in Claude than just write up-front what’s going to happen when you run the code.<p>I’m thinking the reasoning must go something like “Claude writes all my code but at least I can make it write artisanal meta programming to show how clever I am”.
Past related threads. Others?<p><i>Ty – A fast Python type checker, written in Rust</i> - <a href="https://news.ycombinator.com/item?id=46100637">https://news.ycombinator.com/item?id=46100637</a> - Nov 2025 (15 comments)<p><i>Pyrefly vs. Ty: Comparing Python's two new Rust-based type checkers</i> - <a href="https://news.ycombinator.com/item?id=44107655">https://news.ycombinator.com/item?id=44107655</a> - May 2025 (160 comments)<p><i>Ty: A fast Python type checker and language server</i> - <a href="https://news.ycombinator.com/item?id=43918484">https://news.ycombinator.com/item?id=43918484</a> - May 2025 (287 comments)
Congrats on 1.0, this looks really interesting and I'd like to try it. Does ty have any story for Django / DRF yet? I rely on django-stubs and its mypy plugin for models and querysets, so I'm curious how ty handles that kind of dynamic behavior.
We added builtin support for django fairly recently! You can read about it here: <a href="https://docs.astral.sh/ty/features/third-party/django/" rel="nofollow">https://docs.astral.sh/ty/features/third-party/django/</a>
Oh nice, didn't know that, thanks! Does it handle DRF too, or just Django itself? Haven't had a chance to read the docs yet.
Why should the type checker have to know anything about Django? What if I want to make a framework with the same shape? Do I submit a PR to Ty? One that I bet would be rejected because I didn't have any users yet? Users who won't come without type checking support?<p>This style of development is unfair to innovators and ossifies the ecosystem.
Ideally it shouldn't; I don't think anyone would argue otherwise.<p>But (1) django is older than Python's type system, so it uses some very dynamic patterns that are hard to express using Python types. And (2) it's very popular, which means both that lots of people want their type checker to do Something Useful™ with django code, and that it would be very difficult to retrofit django to use dynamic patterns that _are_ more compatible with the type system. That combination makes it worth our time to add specific custom support for it.<p>For your own future library, the hope is that the type system has become capable enough that you wouldn't _need_ custom type checker support. Things like `dataclass_transform` [1] were added specifically so that _all_ libraries could express these kinds of things in ways that are visible to the type checkers without custom support.<p>If you're doing something that still doesn't fit into what the typing system provides, then the Python typing community wants to learn about your use case so that we can see if we can extend the typing system even further to support it.<p>[1] <a href="https://typing.python.org/en/latest/spec/dataclasses.html" rel="nofollow">https://typing.python.org/en/latest/spec/dataclasses.html</a>
Django doesn't really do any too crazy. Most use cases would be filled if there were a way to declare:<p>- Adding field X also adds field x_pk<p>- Adding field X also changes the signature of function Y to accept parameter x, x__lt, x__gt, etc.<p>- Adding field X lets you do a.x = 5, even though X is not really an integer<p>As an aside, I have to give it to the Typescript team for taking Javascript which was fundamentally as metaprogramming happy as Python, and creating a type system that matched it. Having a goal that every popular pattern in Javascript should be type-checked was a great starting choice, because they couldn't simply copy some other languages' static typing methadology and had to work from teh ground up.
There is a <i>lot</i> more than that. Reverse FKs, chained relations (foo__foofk__barfk__in), complexity regarding Django's several understandings of "abstract"/interfaces/protocols (abstract models, form classes that implicitly can or must provide methods with specific names/signatures depending on what fields are on the form, etc.), runtime-generated model classes (how and where to check in or tell the typechecker about those stubs?), lazy objects that change type (gaining <i>and removing/changing</i> behavior) at runtime based on things that are pretty hard for a type checker to notice, like random field access/indexing, and so on.<p>And that's just the core Django dynamism; the stuff that needs to work <i>really well</i>. Not even getting into stuff that would be nice, like custom managers providing methods to model instances, Q/F type helpers, any sort of typing help with templates (even just "can this method be called with the signature this template wants"), complex model introspection typing, something cleaner than pydantic/manual TypedDicts for form data at the ser/de boundary, and so on.<p>Even that bare minimum requires some pretty difficult features, type-checker wise: extremely distant dependent types ("if field X exists, method Y should take kwargs X__in and so on" as in your example, as well as "if field X exists, method get_X must be declared on class Y with signature Z", and "if field X exists, then a very distant method in a model manager needs to be documented to return type Y if values_list=True"), very robust support for runtime-created signatures that in a lot of Django systems <i>cannot</i> be generated and checked in (e.g. database-derived models or JSON-backed fields outside of Postgres), extremely complex dependent typing in classes whose generic bounds are determined pretty late/at mixin time (but which may also conceptually be mixins that can only be used in a very few appropriate cases), and more.<p>Like, just think about model field names in manager method arguments--a tiny fraction of the problem. All the different chained/related kwargs would have to be computed and typed, as well as their disjoint: if I rename field "foo" to "bar", and forget to update some caller that does "m.objects.filter(thing__thing2_fk__foo__in=[1,2])", it'd be great if the type checker could help me catch that. But even if it can't, does that mean that "objects.filter" has all-optional typed kwargs and also takes **kwargs as well, because the type coverage is gradual? As soon as that's allowed, a whole lot of useful typechecking abilities go out the window since misnamed keys can just fall into the wildcard. Solvable, sure, but a major pain in the ass to implement--especially given that Django is a fast-moving target adding/removing/changing functionality all the time.<p>Again, that's just Django <i>basics</i>. Things that ordinary, bog-standard, not-using-advanced-functionality Django code needs all the time. If the typechecker mishandles one of those cases and makes life harder, people will abandon it. There's a very tricky line to walk here re: when to be strict and when to give up on typechecking entirely, but Django has a <i>lot</i> of places where the latter is necessary.
The Python typing community has known about the expressiveness problems for years. It's forward-only, has no HKTs, no type computation, no complement. I can't even do generic parameter list transforms.<p>All of these are known deficiencies. Everyone who brings them up is told to pound sand, their use cases deemed illegitimate. Might as well be GNOME.<p>It's fundamentally unfair that Django gets to use aspects of the language other tools can't, and one hard coded dataclass-style transform is inadequate.<p>So help me God, if I ever do another large scale Python project, then if these issues aren't fixed in typing, I will vendor and modify a type checker in the project itself and teach it my project's patterns directly. I will not twist and distort my design vision so it rhymes with dataclass.
> It's fundamentally unfair that Django gets to use aspects of the language other tools can't<p>You can just ... not typecheck parts of your code. All of these tools are gradual, since Python's much too dynamic to encompass everything. Falling back to runtime "I know how this works" dynamism isn't a sin, it just requires a little care. Add restrictions (typed wrappers, verbosity/limitations <i>a la</i> dataclass_transform) at the boundaries where people make frequent mistakes, and move on with your life.
I agree; we don't like this either. But there is no palatable short-term alternative. If we don't do it, then Django/pydantic/attrs users will just prefer other type checkers that do. The best long-term option is to make all of this expressible in the type system; there are proposals currently under consideration that will go a long way towards this.<p>Plugins do provide a more level playing field, and we aren't closed to the possibility of supporting them in future. But they come with a whole host of challenging technical problems, and we have a lot of other high-priority things to work on.
I'm not sure about Django + Ty specifically, but some dependencies need a plugin because they're impossible to type annotate otherwise. For example, sqlalchemy + mypy
Further discussion on dedicated Django support: <a href="https://github.com/astral-sh/ty/issues/1018" rel="nofollow">https://github.com/astral-sh/ty/issues/1018</a>
We switched from Pyright to Ty during early betas and never looked back. The speed was a clear win, and the few bugs we hit were all resolved. Great work Astral folks.
Fast is the key word here — Python finally getting a type checker that keeps up is very welcome.
Congrats to the Astral team! I've been using ty since the alpha days. Was so excited to replace pylsp with it, and it's been a mainstay in my arsenal ever since. It's gotten so reliable over the past year or so that I forgot it was pre-1.0 software.
Something to note: Ty does not search for modules in the same places that CPython does by default. It will not find modules installed at ~/.local/lib/python{version}/site-packages/. They insist that you use a venv.
Hi! ty doesn't insist on venv usage; we already support discovering packages from non-venv system Pythons. It looks like `~/.local` was just an oversight; as far as I can see no user reported it yet. Working on a PR to add this support.
If you want Django coverage, pyrefly is much better. I also liked pyrefly because their type inference was more conservative. Though ty lists one place where it seems ty is more conservative?
> They insist that you use a venv<p>Hmm, that's not accurate anymore! We look for your Python installation in a number of places these days -- we should discover system installations on PATH, conda installations, pixi installations, and, yes, local virtual environments. Is your Python installation at `~/.local` on PATH?
(sorry, I forgot how local installations work -- of course they are not on PATH. My colleague mentioned above that this is indeed a specific place we don't yet look for installs. My broader point remains that we certainly don't require virtual environments, however.)
our documentation on this: <a href="https://docs.astral.sh/ty/modules/#python-environment" rel="nofollow">https://docs.astral.sh/ty/modules/#python-environment</a>
Congrats! This is a huge milestone. Out of curiosity, what will it take to get Ruff and UV to 1.0.0?
Been using ty since alpha. Definitely fast as advertised but still some functionality missing. Curious to discover if the 1.0 release has filled the gaps.<p>Python's typing system has really matured and with 3.14 most of the ergonomic issues have been ironed out. Between that and AI coding there's no good reason not to have strict type checking on your python code. But mypy is simply too slow to use in practice though so it'll be between ty and pyrefly I guess.
Excellent. Introduced ty at work earlier this year and many teams have been using it with great success on small and medium size projects. Will be trying out 1.0 soon.
Congrats to the Ty team. Been using it for a while now.<p>Funnily though I’ve started to care less about typing in Python. Since Rust got good most projects where I’d want strong types I’m not using Python anymore. Python is still great for glue code, as it was intended. Typing helps there if libraries have good support but I find myself writing Python type annotations less now. It’s always been a bit awkward and ugly in Python anyway.
Can any of the LSPs give type info for tensor methods in pytorch? It has always surprised me that we dont get transcluded documentation for those from their static function counterparts (usually it just says like `See :func: torch.permute` if i hover over `x.permute`)
I love this… but. My most frequent editor these days is one that only lets me configure one language server per open file, so today I have to choose between a linter or a type checker, but not both at once. I do so which this were a ruff plugin or vice versa.
Just use a LSP multiplexer like rassumfrassum: <a href="https://github.com/joaotavora/rassumfrassum" rel="nofollow">https://github.com/joaotavora/rassumfrassum</a>.<p>By the author of Emacs builtin LSP server (eglot), but completely generic.
There may be a future where these are combined into a single language server; we're working on the details.<p>In the meantime, I think there are "LSP multiplexers" which can present a single language server to your editor and proxy multiple language servers, though I don't have personal experience using these.
Not an endorsement, but for example, there's <a href="https://github.com/joaotavora/rassumfrassum" rel="nofollow">https://github.com/joaotavora/rassumfrassum</a> which includes a ty / ruff preset
Too bad it doesn't support Django 6.<p>The real issue is that ty's Django support is still early: reverse relations and django-stubs aren't supported yet, and django-types is already lagging behind Django 6.
> ty also includes built-in support for foundational Python libraries like Pydantic, Django, pytest, and attrs<p>Does adding `django-stubs` not work?<p>I haven't tried it myself, as I don't use Django.
Great work by Astral. The 24x speedup at OpenAI is impressive. How smooth is the migration from mypy to ty for existing projects?
ty does not aim to be a drop-in replacement for Mypy (there are many things that we wanted to improve), so migration does take some effort. You can find migration tips in our documentation here: <a href="https://docs.astral.sh/ty/coming-from-mypy-or-pyright/" rel="nofollow">https://docs.astral.sh/ty/coming-from-mypy-or-pyright/</a>
Been using Ty for nearly a year or so now on my Django backend. Been very impressed as I've seen the versions tick up and up. Thanks for this.
Has anyone had success integrating a type checker like Ty, Pyright, MyPy etc. into a large Django monolith that currently has no type checking at all?
Yes, but most of the success was rooted in refactoring code (frequently changing subtle behavior or performance characteristics, and occasionally changing larger behaviors) to make the Django code typechecking-friendly.<p>It did end up feeling pretty ceremonial to use. The end state was a lot better than the original state, and bugs less common. But the code that we ended up with had some significant perf issues (e.g. difficulties in typechecking queries which joined through arbitrary sub-QuerySet objects or F/Q objects meant that support for those was removed from a lot of common APIs and reserved for the internals of a few per-usecase functions), and ... frankly felt like the more tedious parts of vanilla Java at times.<p>The pattern of "make a type-parametrized and fully annotated wrapper containing just the methods/data you expect to be able to call on some large and extensively-metaprogrammed model/form/view, pass that wrapper to code that needs its functionality by hand, old-school-dependency-injection-style" worked well as a way of delineating new/typechecked code from e.g. aspirationally-typed methods added to a large and impossible-to-type pre-existing object.<p>Again, better than before. Just ... a lot more invasive than "just add types/wrappers" and a bit more tedious to use afterwards.
What's the thinking on the future of Python outside of AI specific tasks?<p>In a post-AI world I imagine most projects will reach for a sensible static code alternative.
If anything, I personally expect python use to increase.<p>Python in 2026 is basically as typed as you want it to be. I've been seeing a ton of success from telling my agents to type-hint extensively, and then throw in things like pydantic, which can do all of the messy json-parsing-dict-soup for you behind the scenes, and you have a perfect blend where you have types where they help, and then can skip them where they don't (test code, messy parsing pydantic might not cover, etc).<p>Agents benefit from the huge amounts of training data, and the ability to interact with the code in a way it can't in rust. Notably, claude (and distillations thereof) are clearly trained to use python for lots of general "bash-ish" type calls, and then your language being python + your code being python then lets it get super creative in exploring and figuring stuff out.<p>And finally, python being easy and expressive for humans to write carries over to agents too, IME. They just do really well with it.<p>Just my 2c. Everyone keeps saying they don't read the code anymore, so it might as well be rust. But somehow I keep ending up needing to look at code, and when I do, I still prefer it to be python. And am annoyed when it's not (e.g. at work).
Some problems beg for Django. There's really nothing else like it. You can do some amazing stuff with Django and Unfold, and agents are happy to write it.<p>But yeah aside from an AI lab where python was the lingua franca, I haven't felt the need to reach for python itself in years.
Personally speaking with all these companies rewriting their stuff in Rust I don't see much use case for Python unless you are in ML research.
Small scripts and tools remain in Python. Data science needs Python for exploratory type work. Backend stuff can use whatever language works for the business.
Last time I evaluated ty and pyrefly, I ended up sticking with basedpyright. Its type inference felt the most complete. Curious to see if things have changed.
re: basedpyright<p><a href="https://detachhead.codeberg.page/workproperly/blog/2026/11/24/the-state-of-python-type-checking-and-the-future-of-basedpyright/#upstream-maintenance" rel="nofollow">https://detachhead.codeberg.page/workproperly/blog/2026/11/2...</a>
Oh damn, completely missed this. Thanks for bringing it to my attention.<p>> As of writing this, more of the rules covered by basedpyright are covered by *<i>pyrefly*</i> than ty, and there are a few missing features in ty that make it not really feasible to use yet in real projects<p>(My emphasis.) Seems I'll be switching to pyrefly then.<p>Detachhead has done such a good job bringing pylance's proprietary features to the masses. I also appreciated how he just cut through the bullshit in the pyright issue tracker.<p>So reading this part, I feel for him:<p>> what AI has done to programming has significantly impacted my motivation to work on open source projects. [..] In fact I kinda no longer really enjoy interacting with other developers at all.
I switched from pyright to pyrefly like 6 months ago, and it's been fantastic
so far. It has holes on some packages that use complicated meta-programming tricks, like sqlalchemy, but other than that no issues. It certainly finds more code smells
than pyright for me.
So if OpenAI owns Astral, and Microsoft has Pyright, don't two companies effectively dominate both Python and TypeScript ecosystems?<p>I have nothing against Ty, it is quite powerful, and released under MIT.<p>This blog post also tells us that Ty is used extensively at OpenAI, like we're meant to be impressed.
Pyrefly (Meta) has been the preferred type checker in my social circles for Python, for a while now. OpenAI acquisition in this regard has been viewed as a net negative, if anything, for using Astral's tools. OpenAI has yet to establish a track record for maintaining open-source software for years, the company is simply too young.
ZubanLS is also quite good.<p><a href="https://zubanls.com" rel="nofollow">https://zubanls.com</a>
> So if OpenAI owns Astral, and Microsoft has Pyright, don't two companies effectively dominate both Python and TypeScript ecosystems?<p>I got a 2 weeks ban on the python discuss instance for suggesting that core contributors who contribute as their job should disclose who their employer is.
Microsoft owns the .NET ecosystem and the npm ecosystem via GitHub (which in itself is a massive asset). Broadcom basically owns modern enterprise Java stack via SpringSource. Nothing to be seen here apart from companies realizing there is value in ecosystems (decades after Oracle/Java). OpenAI buying Astral (and investing heavily) was a way to dominate the Python ecosystem. Anthropic has bought Oven (i.e. Bun), but the jury is still out on that one in terms of market or ecosystem domination (watch out for upcoming AoT release though).
Does this mean I can unintall basedpyright and nodejs stuff?
Looks like Rust single-handedly improved python's ecosystem!
congrats to the team!
running ruff + mypy + pytest after every change, ruff is basically instant while mypy is always the slow part of the loop.
Fast type checking is very welcome here
Cool. I’ll vibe code something very similar with Claude.
sick!
[dead]
[dead]
[dead]
[dead]
[dead]
[dead]
Tried it on a 10k loc project which never had a type checker: 0.5s, 450 results. More than 400 of them are one pattern, a dict of kwargs splatted into a call (`*kw`). ty infers the dict as `dict[str, str | int]` and flags every parameter against that. Is there any way to type the dict once, or is a TypedDict the way to go?
We do generally support this pattern for dictionary literals, but we can't track the precise types of arbitrary keys if the dictionary is created dynamically, you'd have to use a TypedDict in that case.
Thanks, I think I'll will be adding it to my project.<p>With the TypedDicts I'm now down to 109 from 450: <a href="https://github.com/Plexito-de/spantruth/pull/121" rel="nofollow">https://github.com/Plexito-de/spantruth/pull/121</a>
From my experience working with complicated python dicts in an established project and trying to rely on the automatic inference, putting off making a TypedDict, I'd say don't do it.<p>Just make the typed one immediately and save yourself the headache. Though in my case ty was actively updating and messing with the dicts, so a valid inference one day would be invalid the next time I updated dependencies (new rules would help in other places, so I would gain some and lose some from doing this).
Typing spec has some detailed info if you'd like <a href="https://typing.python.org/en/latest/spec/typeddict.html" rel="nofollow">https://typing.python.org/en/latest/spec/typeddict.html</a><p>Summarizing, for something that is an argument with specific fields you'd use a Mapping or a MutableMapping as the annotation, and if that's a return value, then it should be a TypedDict. Sometimes TypedDict also makes sense as an argument annotation, e.g., if it has to be a dict strictly.<p>For a generic dictionary, like you know that you're drawing from a set of possible kwargs that are all string values, you can also just annotate them with an "anonymous" dict like what Ty is inferring on your codebase.
[dead]
[dead]
[dead]
I thought everything can be vibe coded in Rust. Turns out OpenAI are Luddites and use Python.<p>Remember when Astral told us in 2024 they would not sell out?
If there are license changes or any user hostile behavior then you might say they sold out. But so far, they have been improving the ecosystem!
Thanks for the great work team! Congratulations on reaching another milestone.
Ty is, in fact, written in Rust with substantial AI assistance. I think it is reasonably uncontroversial that Python remains the more suitable language for ML research, which of course is something that OpenAI cares about very much.
> Remember when Astral told us in 2024 they would not sell out?<p>It was VC owned from the start, not a community project.
everybody sells out at the right price. You're a sellout just by working for someone.
By sellout they mean someone breaking promises for money. Not someone who is selling things/skills/time for money.
Nope. Getting paid and selling out are distinct things. It depends on whether your integrity is included in the sale price.
I got excited when ty came out because the LSP experience was so much better than I had before with pylsp-mypy. But then I lost interest in programming due to AI. I've been watching the releases and it's pretty obvious there's a lot of "AI assisted" development going on. Kinda funny that they're using AI to make a tool which is pointless because of AI.
> pretty obvious there's a lot of "AI assisted" development going on<p>I don't think it's that bad? They don't sign commits with Codex, the agent-specific documentation is very minimal, human discussion still takes place on every PR. Obviously the devs are using AI to some capacity, that's true of every project still developed these days. Compared to projects like Bun, the AI usage seems perfectly responsible.
But type checking is useful to AI?
Taiwan!
now ai do all coding , LSP seems not useful as before.
[flagged]