46 comments

  • cataflam11 hours ago
    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&#x27;s 98% (and I didn&#x27;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:&#x2F;&#x2F;github.com&#x2F;python&#x2F;typing&#x2F;blob&#x2F;main&#x2F;conformance&#x2F;results&#x2F;results.html" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;typing&#x2F;blob&#x2F;main&#x2F;conformance&#x2F;resul...</a>
    • jrimbault5 hours ago
      <a href="https:&#x2F;&#x2F;htmlpreview.github.io&#x2F;?https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;typing&#x2F;blob&#x2F;main&#x2F;conformance&#x2F;results&#x2F;results.html" rel="nofollow">https:&#x2F;&#x2F;htmlpreview.github.io&#x2F;?https:&#x2F;&#x2F;github.com&#x2F;python&#x2F;typ...</a> (just to not read raw html)
    • maxloh4 hours ago
      How does mypy score so low? Isn&#x27;t it the reference implementation?
      • LoganDark4 hours ago
        mypy existed before the spec and still remains relatively compatible with older versions of itself.
    • globular-toast3 hours ago
      I&#x27;m not sure how meaningful this conformance suite is given that ty doesn&#x27;t properly handle `finally` but I can&#x27;t see that on there.
  • adsharma13 hours ago
    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&#x2F;sqlmodel too.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;adsharma&#x2F;fquery&#x2F;blob&#x2F;main&#x2F;tests&#x2F;django_example_model.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;adsharma&#x2F;fquery&#x2F;blob&#x2F;main&#x2F;tests&#x2F;django_ex...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;adsharma&#x2F;fastapi-shopping&#x2F;blob&#x2F;main&#x2F;src&#x2F;fastapi_shopping&#x2F;models.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;adsharma&#x2F;fastapi-shopping&#x2F;blob&#x2F;main&#x2F;src&#x2F;f...</a>
    • rtpg11 hours ago
      Your premise is not true IMO, you can totally get &quot;correct&quot; type checking on fields (including things like &quot;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:&#x2F;&#x2F;gist.github.com&#x2F;rtpg&#x2F;ac1950e6c390ddd7a02ddc941ee75c5f" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;rtpg&#x2F;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&#x27;t need top-level type annotations to get type checking form mypy and friends!<p>People&#x27;s first idea when trying to tackle types in Python is &quot;OK I want this field to be an int so I will have an API that labels it an int&quot; but if you lean into descriptors you will get a much more flexible system that can handle more scenarios.<p>Being able to distinguish &quot;types that can be written to a field&quot; from &quot;types that are read from a field&quot; in particular are _so straightforward_ all things considered.<p>This doesn&#x27;t solve a lot of the reverse relation issues and annotations on querysets but neither does your library.
      • adsharma11 hours ago
        There is no formal system backing up this style of typing. I&#x27;m also of the opinion that any such type enhancements have to be friendly towards machine translation to Rust.<p>I maintain one such transpiler.<p>Dependent types that can be machine translated to lean4 proposed here. Google static python skill.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;py2many&#x2F;static-python-skill" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;py2many&#x2F;static-python-skill</a>
        • dcreager11 hours ago
          &gt; There is no formal system backing up this style of typing<p>This is not true. Python&#x27;s typing system is based on two typing formalisms that are well studied in the academic literature: set-theoretic typing and gradual typing. We&#x27;ve drawn a lot of inspiration in particular from the work done by Giuseppe Castagna and his collaborators.<p>Elixir&#x27;s type system is based on exactly the same formalisms, and our teams have met several times to share notes on the underlying concepts, and on implementation techniques. Guillaume Duboc&#x27;s PhD thesis, which he defended earlier this year, is a particularly strong example of this; we were able to implement an incredibly effective optimization [1] based on his work optimizing disjunctive types in Elixir&#x27;s type checker.<p>Now, it&#x27;s definitely true that Python is a very complex language, and so its type system does not (and cannot) implement the academic set-theoretic algorithms directly. But it provides exactly the formalism that we need to reason about the kinds of code that appears in real-world Python programs.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;astral-sh&#x2F;ruff&#x2F;pull&#x2F;23881" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;astral-sh&#x2F;ruff&#x2F;pull&#x2F;23881</a>
          • dcreager10 hours ago
            (And to connect it upthread, intersection types let you implement a form of row polymorphism [2], which give you some of the pieces that you need to model these more complex django examples. Not all of it is connected yet to constructs that are available e.g. in the `typing` module, but the underlying formalisms are sound.)<p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;astral-sh&#x2F;ruff&#x2F;pull&#x2F;28457" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;astral-sh&#x2F;ruff&#x2F;pull&#x2F;28457</a>
            • rtpg10 hours ago
              I do hope that we can get all the pieces together and be able to really express everything without plugins or special casing in the code. I think we&#x27;re close!<p>I do want to have better ergonomics for the type-level programming overall. Typescript is a relative joy to work on (still a pain), but even just some simple &quot;attribute mapping&quot; mechanisms would be cool
        • rtpg10 hours ago
          &gt; There is no formal system backing up this style of typing.<p>I mean just abstractly speaking you can define semantics on a typing relation that behaves this specific way based on a class definition. You have to futz around a bit to distinguish writes from reads, but it&#x27;s &quot;just&quot; busywork IMO. I don&#x27;t believe there&#x27;s some semantic difficulties there. Subtyping issues are way worse than this, at first blush (ready to be told otherwise though!)<p>&gt; I&#x27;m also of the opinion that any such type enhancements have to be friendly towards machine translation to Rust.<p>I mean that&#x27;s your opinion. I have nothing against Rust and use it but my objective in using Python is to use Python.
          • adsharma7 hours ago
            &gt; my objective in using Python is to use Python.<p>The rate at which people are rewriting python in Rust, there will be very little left.<p>My goal for the last 5 yrs has been to make sure they don&#x27;t do it manually.<p>Much of the resistance I run into is because of exactly this sentiment, which I think will be overcome because of market and technological pressures.<p>I also believe that a smaller subset of python is more amenable to formal verification some of it via the type system vs something like Verus&#x2F;Rust.
    • kevsamuel3 hours ago
      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:&#x2F;&#x2F;www.pystebin.com&#x2F;p&#x2F;06b0fd4e-e84c-7099-8000-09197d731613&#x2F;?python=3.14&amp;wrap=0&amp;linenum=1" rel="nofollow">https:&#x2F;&#x2F;www.pystebin.com&#x2F;p&#x2F;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&#x27;s not limited by Python type design anymore.
    • unconscionable13 hours ago
      And for Pydantic models and higher performance: <a href="https:&#x2F;&#x2F;github.com&#x2F;ebrake&#x2F;sway-orm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ebrake&#x2F;sway-orm</a>
      • adsharma11 hours ago
        Nice. The main difference in thinking is that existing python ORMs use implementation inheritance (Model&#x2F;BaseModel).<p>I&#x27;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.
  • memco16 hours ago
    I&#x27;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&#x27;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&#x27;s a mishmash of information and feels lacking.
    • zanie15 hours ago
      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.
      • flatline14 hours ago
        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.
        • masklinn2 hours ago
          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.
    • zanie15 hours ago
      What&#x27;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)
  • fishgoesblub18 hours ago
    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.
    • ibejoeb17 hours ago
      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.
    • _carljm17 hours ago
      Would be happy to know where we could do better, if you do this comparison on your codebase today. GH issues are open!
      • eyegor6 hours ago
        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&#x27;t respect any forms of &quot;&quot;&quot; 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.
    • fukaiall12 hours ago
      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
    • NostraDavid16 hours ago
      &gt; at the time<p>Any indication of when that was? Just being curious.
      • wiseowise15 hours ago
        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.
        • Balinares4 hours ago
          Then it&#x27;s definitely come a long way. It works just fine now.
      • fishgoesblub13 hours ago
        I think I switched to Pyrefly in very early 2026? I can&#x27;t remember.
    • tasuki13 hours ago
      &gt; A bit spoiled for choice in regards to Python type checkers now.<p>&quot;Spoiled&quot; is not the word I&#x27;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&#x27;s usually one type checker and it works – there&#x27;s no need to create several competing-but-all-broken-in-various-ways type checkers.
  • kccqzy16 hours ago
    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.
    • flexagoon12 hours ago
      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.
      • rkangel3 hours ago
        I just spent a week doing a medium sized python project with Claude, and purposefully didn&#x27;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.
    • quotemstr15 hours ago
      Can&#x27;t apply a technical fix to a social problem. Rigor mismatch, I&#x27;ve found, bus just a personality clash that doesn&#x27;t get better over time.
    • IshKebab13 hours ago
      I&#x27;ve been in your situation. It&#x27;s difficult to convince people who have never used static types that it&#x27;s worth it. Especially in a codebase that didn&#x27;t use them from the start because it&#x27;s easily 3x more work to add them after the fact. At least pre-AI. These days you can probably just say &quot;Claude, add type annotations everywhere&quot; and I imagine it would do a pretty perfect job.
      • ripharamberip8 hours ago
        Convincing people of static typing who don&#x27;t care is like explaining color to a blind person
    • refactor_master12 hours ago
      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”.
  • dang16 hours ago
    Past related threads. Others?<p><i>Ty – A fast Python type checker, written in Rust</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46100637">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46100637</a> - Nov 2025 (15 comments)<p><i>Pyrefly vs. Ty: Comparing Python&#x27;s two new Rust-based type checkers</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=44107655">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=44107655</a> - May 2025 (160 comments)<p><i>Ty: A fast Python type checker and language server</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43918484">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43918484</a> - May 2025 (287 comments)
    • ocamoss15 hours ago
      Those are pretty out of date, esp the comparison post - a lot of development has happened in the last year and a half.
  • natsu52917 hours ago
    Congrats on 1.0, this looks really interesting and I&#x27;d like to try it. Does ty have any story for Django &#x2F; DRF yet? I rely on django-stubs and its mypy plugin for models and querysets, so I&#x27;m curious how ty handles that kind of dynamic behavior.
    • alexwaygood17 hours ago
      We added builtin support for django fairly recently! You can read about it here: <a href="https:&#x2F;&#x2F;docs.astral.sh&#x2F;ty&#x2F;features&#x2F;third-party&#x2F;django&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docs.astral.sh&#x2F;ty&#x2F;features&#x2F;third-party&#x2F;django&#x2F;</a>
      • natsu52917 hours ago
        Oh nice, didn&#x27;t know that, thanks! Does it handle DRF too, or just Django itself? Haven&#x27;t had a chance to read the docs yet.
        • alexwaygood17 hours ago
          I don&#x27;t think we have any special handling of DRF (yet). It would be good to know exactly what you need there! Feel free to file an issue on GitHub :-)
          • natsu52917 hours ago
            Thanks for the quick answer! I&#x27;ll write up what I&#x27;d need for DRF and open an issue.
      • quotemstr16 hours ago
        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&#x27;t have any users yet? Users who won&#x27;t come without type checking support?<p>This style of development is unfair to innovators and ossifies the ecosystem.
        • dcreager16 hours ago
          Ideally it shouldn&#x27;t; I don&#x27;t think anyone would argue otherwise.<p>But (1) django is older than Python&#x27;s type system, so it uses some very dynamic patterns that are hard to express using Python types. And (2) it&#x27;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&#x27;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&#x27;re doing something that still doesn&#x27;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:&#x2F;&#x2F;typing.python.org&#x2F;en&#x2F;latest&#x2F;spec&#x2F;dataclasses.html" rel="nofollow">https:&#x2F;&#x2F;typing.python.org&#x2F;en&#x2F;latest&#x2F;spec&#x2F;dataclasses.html</a>
          • true_religion12 hours ago
            Django doesn&#x27;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&#x27;t simply copy some other languages&#x27; static typing methadology and had to work from teh ground up.
            • zbentley10 hours ago
              There is a <i>lot</i> more than that. Reverse FKs, chained relations (foo__foofk__barfk__in), complexity regarding Django&#x27;s several understandings of &quot;abstract&quot;&#x2F;interfaces&#x2F;protocols (abstract models, form classes that implicitly can or must provide methods with specific names&#x2F;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&#x2F;changing</i> behavior) at runtime based on things that are pretty hard for a type checker to notice, like random field access&#x2F;indexing, and so on.<p>And that&#x27;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&#x2F;F type helpers, any sort of typing help with templates (even just &quot;can this method be called with the signature this template wants&quot;), complex model introspection typing, something cleaner than pydantic&#x2F;manual TypedDicts for form data at the ser&#x2F;de boundary, and so on.<p>Even that bare minimum requires some pretty difficult features, type-checker wise: extremely distant dependent types (&quot;if field X exists, method Y should take kwargs X__in and so on&quot; as in your example, as well as &quot;if field X exists, method get_X must be declared on class Y with signature Z&quot;, and &quot;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&quot;), 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&#x2F;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&#x2F;related kwargs would have to be computed and typed, as well as their disjoint: if I rename field &quot;foo&quot; to &quot;bar&quot;, and forget to update some caller that does &quot;m.objects.filter(thing__thing2_fk__foo__in=[1,2])&quot;, it&#x27;d be great if the type checker could help me catch that. But even if it can&#x27;t, does that mean that &quot;objects.filter&quot; has all-optional typed kwargs and also takes **kwargs as well, because the type coverage is gradual? As soon as that&#x27;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&#x2F;removing&#x2F;changing functionality all the time.<p>Again, that&#x27;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&#x27;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.
          • quotemstr16 hours ago
            The Python typing community has known about the expressiveness problems for years. It&#x27;s forward-only, has no HKTs, no type computation, no complement. I can&#x27;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&#x27;s fundamentally unfair that Django gets to use aspects of the language other tools can&#x27;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&#x27;t fixed in typing, I will vendor and modify a type checker in the project itself and teach it my project&#x27;s patterns directly. I will not twist and distort my design vision so it rhymes with dataclass.
            • zbentley10 hours ago
              &gt; It&#x27;s fundamentally unfair that Django gets to use aspects of the language other tools can&#x27;t<p>You can just ... not typecheck parts of your code. All of these tools are gradual, since Python&#x27;s much too dynamic to encompass everything. Falling back to runtime &quot;I know how this works&quot; dynamism isn&#x27;t a sin, it just requires a little care. Add restrictions (typed wrappers, verbosity&#x2F;limitations <i>a la</i> dataclass_transform) at the boundaries where people make frequent mistakes, and move on with your life.
        • _carljm16 hours ago
          I agree; we don&#x27;t like this either. But there is no palatable short-term alternative. If we don&#x27;t do it, then Django&#x2F;pydantic&#x2F;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&#x27;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.
          • quotemstr16 hours ago
            These proposals have stalled behind consensus hell for years. Enabling plugins would be a pragmatic option: you could even spell them as HKTs or something right in the source. Or you could enable private type system extensions.
        • goodoldneon16 hours ago
          I&#x27;m not sure about Django + Ty specifically, but some dependencies need a plugin because they&#x27;re impossible to type annotate otherwise. For example, sqlalchemy + mypy
          • quotemstr16 hours ago
            Exactly. Why are we baking support for this or that package to the core instead of enabling plugins or just making the type system more expressive?
            • zbentley10 hours ago
              Another commenter explained pretty well why Django is &quot;special&quot; here: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=50720035">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=50720035</a>
            • LtWorf13 hours ago
              It takes a great effort and time to push things like PEP747 forward and when you manage, perhaps you need to wait several years until the lowest supported version of python implements the changes you wanted.
          • alex788816 hours ago
            [dead]
            • LtWorf13 hours ago
              pydantic needed the mypy plugin from the beginning because their types meant something different than the python semantics. For example pydantic allowed &quot;a: int = None&quot; which is an error for mypy.
    • rsyring14 hours ago
      Further discussion on dedicated Django support: <a href="https:&#x2F;&#x2F;github.com&#x2F;astral-sh&#x2F;ty&#x2F;issues&#x2F;1018" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;astral-sh&#x2F;ty&#x2F;issues&#x2F;1018</a>
  • scosman13 hours ago
    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.
  • diogofonseca59 minutes ago
    Fast is the key word here — Python finally getting a type checker that keeps up is very welcome.
  • wilkystyle18 hours ago
    Congrats to the Astral team! I&#x27;ve been using ty since the alpha days. Was so excited to replace pylsp with it, and it&#x27;s been a mainstay in my arsenal ever since. It&#x27;s gotten so reliable over the past year or so that I forgot it was pre-1.0 software.
  • chaz615 hours ago
    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 ~&#x2F;.local&#x2F;lib&#x2F;python{version}&#x2F;site-packages&#x2F;. They insist that you use a venv.
    • _carljm15 hours ago
      Hi! ty doesn&#x27;t insist on venv usage; we already support discovering packages from non-venv system Pythons. It looks like `~&#x2F;.local` was just an oversight; as far as I can see no user reported it yet. Working on a PR to add this support.
    • satya7114 hours ago
      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?
    • alexwaygood15 hours ago
      &gt; They insist that you use a venv<p>Hmm, that&#x27;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 `~&#x2F;.local` on PATH?
      • alexwaygood14 hours ago
        (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&#x27;t yet look for installs. My broader point remains that we certainly don&#x27;t require virtual environments, however.)
        • chaz62 hours ago
          I was remembering an old report from uv requesting the pip equivalent of --user and being told that it would never support it.
      • alexwaygood15 hours ago
        our documentation on this: <a href="https:&#x2F;&#x2F;docs.astral.sh&#x2F;ty&#x2F;modules&#x2F;#python-environment" rel="nofollow">https:&#x2F;&#x2F;docs.astral.sh&#x2F;ty&#x2F;modules&#x2F;#python-environment</a>
        • chaz62 hours ago
          That is where I looked, and it does not include ~&#x2F;.local&#x2F;lib which is where `pip install --user` installs to by default.
  • BewareTheYiga17 hours ago
    Congrats! This is a huge milestone. Out of curiosity, what will it take to get Ruff and UV to 1.0.0?
  • user-error6 hours ago
    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&#x27;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&#x27;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&#x27;ll be between ty and pyrefly I guess.
  • microflash8 hours ago
    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.
  • WD-4217 hours ago
    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.
  • dkmar13 hours ago
    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`)
    • zem1 hour ago
      pyrefly has experimental support for tensor shapes: <a href="https:&#x2F;&#x2F;pyrefly.org&#x2F;en&#x2F;docs&#x2F;tensor-shapes&#x2F;?version=1.5.1" rel="nofollow">https:&#x2F;&#x2F;pyrefly.org&#x2F;en&#x2F;docs&#x2F;tensor-shapes&#x2F;?version=1.5.1</a>
  • kstrauser14 hours ago
    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.
    • yaantc14 hours ago
      Just use a LSP multiplexer like rassumfrassum: <a href="https:&#x2F;&#x2F;github.com&#x2F;joaotavora&#x2F;rassumfrassum" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;joaotavora&#x2F;rassumfrassum</a>.<p>By the author of Emacs builtin LSP server (eglot), but completely generic.
      • kstrauser10 hours ago
        I&#x27;m using that now (with BBEdit) and it&#x27;s overall alright, but it&#x27;d still be nicer and easier to deploy and configure if they were besties.
      • jason_s7 hours ago
        love the name, LMAO
    • _carljm14 hours ago
      There may be a future where these are combined into a single language server; we&#x27;re working on the details.<p>In the meantime, I think there are &quot;LSP multiplexers&quot; which can present a single language server to your editor and proxy multiple language servers, though I don&#x27;t have personal experience using these.
      • zanie14 hours ago
        Not an endorsement, but for example, there&#x27;s <a href="https:&#x2F;&#x2F;github.com&#x2F;joaotavora&#x2F;rassumfrassum" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;joaotavora&#x2F;rassumfrassum</a> which includes a ty &#x2F; ruff preset
  • BoumTAC16 hours ago
    Too bad it doesn&#x27;t support Django 6.<p>The real issue is that ty&#x27;s Django support is still early: reverse relations and django-stubs aren&#x27;t supported yet, and django-types is already lagging behind Django 6.
    • NostraDavid16 hours ago
      &gt; 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&#x27;t tried it myself, as I don&#x27;t use Django.
      • BoumTAC16 hours ago
        No, it doesn&#x27;t support reverse relations for example
  • ravipatip6 hours ago
    Great work by Astral. The 24x speedup at OpenAI is impressive. How smooth is the migration from mypy to ty for existing projects?
    • sharkdp3 minutes ago
      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:&#x2F;&#x2F;docs.astral.sh&#x2F;ty&#x2F;coming-from-mypy-or-pyright&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docs.astral.sh&#x2F;ty&#x2F;coming-from-mypy-or-pyright&#x2F;</a>
  • seanw44416 hours ago
    Been using Ty for nearly a year or so now on my Django backend. Been very impressed as I&#x27;ve seen the versions tick up and up. Thanks for this.
  • lastofus11 hours ago
    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?
    • zbentley10 hours ago
      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&#x2F;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 &quot;make a type-parametrized and fully annotated wrapper containing just the methods&#x2F;data you expect to be able to call on some large and extensively-metaprogrammed model&#x2F;form&#x2F;view, pass that wrapper to code that needs its functionality by hand, old-school-dependency-injection-style&quot; worked well as a way of delineating new&#x2F;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 &quot;just add types&#x2F;wrappers&quot; and a bit more tedious to use afterwards.
  • barelysapient15 hours ago
    What&#x27;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.
    • atomicnumber315 hours ago
      If anything, I personally expect python use to increase.<p>Python in 2026 is basically as typed as you want it to be. I&#x27;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&#x27;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&#x27;t in rust. Notably, claude (and distillations thereof) are clearly trained to use python for lots of general &quot;bash-ish&quot; 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&#x27;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&#x27;s not (e.g. at work).
    • ibejoeb14 hours ago
      Some problems beg for Django. There&#x27;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&#x27;t felt the need to reach for python itself in years.
    • pratzc0714 hours ago
      Personally speaking with all these companies rewriting their stuff in Rust I don&#x27;t see much use case for Python unless you are in ML research.
    • __mharrison__11 hours ago
      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.
  • lemontheme16 hours ago
    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.
    • ocamoss15 hours ago
      re: basedpyright<p><a href="https:&#x2F;&#x2F;detachhead.codeberg.page&#x2F;workproperly&#x2F;blog&#x2F;2026&#x2F;11&#x2F;24&#x2F;the-state-of-python-type-checking-and-the-future-of-basedpyright&#x2F;#upstream-maintenance" rel="nofollow">https:&#x2F;&#x2F;detachhead.codeberg.page&#x2F;workproperly&#x2F;blog&#x2F;2026&#x2F;11&#x2F;2...</a>
      • lemontheme2 hours ago
        Oh damn, completely missed this. Thanks for bringing it to my attention.<p>&gt; 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&#x27;ll be switching to pyrefly then.<p>Detachhead has done such a good job bringing pylance&#x27;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>&gt; 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.
    • darkwi11ow16 hours ago
      I switched from pyright to pyrefly like 6 months ago, and it&#x27;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.
  • ethnrob19 hours ago
    So if OpenAI owns Astral, and Microsoft has Pyright, don&#x27;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&#x27;re meant to be impressed.
    • arthur-st17 hours ago
      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&#x27;s tools. OpenAI has yet to establish a track record for maintaining open-source software for years, the company is simply too young.
      • tonyhart74 hours ago
        its under MIT license ????? people can fork it
    • GregorBrandt14 hours ago
      ZubanLS is also quite good.<p><a href="https:&#x2F;&#x2F;zubanls.com" rel="nofollow">https:&#x2F;&#x2F;zubanls.com</a>
    • LtWorf17 hours ago
      &gt; So if OpenAI owns Astral, and Microsoft has Pyright, don&#x27;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.
    • pronik18 hours ago
      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&#x2F;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).
  • est9 hours ago
    Does this mean I can unintall basedpyright and nodejs stuff?
  • akimworks13 hours ago
    Looks like Rust single-handedly improved python&#x27;s ecosystem!
    • tuananh10 hours ago
      and nodejs. and php <a href="https:&#x2F;&#x2F;laravel.com&#x2F;blog&#x2F;introducing-laravel-for-rust" rel="nofollow">https:&#x2F;&#x2F;laravel.com&#x2F;blog&#x2F;introducing-laravel-for-rust</a>
  • ocamoss17 hours ago
    congrats to the team!
  • ordesign16 hours ago
    running ruff + mypy + pytest after every change, ruff is basically instant while mypy is always the slow part of the loop.
  • alessiorossi15 hours ago
    Fast type checking is very welcome here
  • hauntingseaweed10 hours ago
    Cool. I’ll vibe code something very similar with Claude.
  • will_raphaelson14 hours ago
    sick!
  • listinglens3 hours ago
    [dead]
  • rushabh50008 hours ago
    [dead]
  • iceskysl2 hours ago
    [dead]
  • luminarklabs5 hours ago
    [dead]
  • yoy07218 hours ago
    [dead]
  • xiaoliangliang8 hours ago
    [dead]
  • chrikrah18 hours ago
    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?
    • ibraheemdev17 hours ago
      We do generally support this pattern for dictionary literals, but we can&#x27;t track the precise types of arbitrary keys if the dictionary is created dynamically, you&#x27;d have to use a TypedDict in that case.
      • chrikrah5 hours ago
        Thanks, I think I&#x27;ll will be adding it to my project.<p>With the TypedDicts I&#x27;m now down to 109 from 450: <a href="https:&#x2F;&#x2F;github.com&#x2F;Plexito-de&#x2F;spantruth&#x2F;pull&#x2F;121" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Plexito-de&#x2F;spantruth&#x2F;pull&#x2F;121</a>
    • Aerolfos4 hours ago
      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&#x27;d say don&#x27;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).
    • arthur-st17 hours ago
      Typing spec has some detailed info if you&#x27;d like <a href="https:&#x2F;&#x2F;typing.python.org&#x2F;en&#x2F;latest&#x2F;spec&#x2F;typeddict.html" rel="nofollow">https:&#x2F;&#x2F;typing.python.org&#x2F;en&#x2F;latest&#x2F;spec&#x2F;typeddict.html</a><p>Summarizing, for something that is an argument with specific fields you&#x27;d use a Mapping or a MutableMapping as the annotation, and if that&#x27;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&#x27;re drawing from a set of possible kwargs that are all string values, you can also just annotate them with an &quot;anonymous&quot; dict like what Ty is inferring on your codebase.
  • CylVolumeCalc6 hours ago
    [dead]
  • hackerbone3 hours ago
    [dead]
  • oiwdis17 hours ago
    [dead]
  • 12233981717 hours ago
    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?
    • analog_daddy17 hours ago
      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.
      • zanie13 hours ago
        Appreciate it &lt;3
    • ameliaquining16 hours ago
      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.
    • LtWorf13 hours ago
      &gt; Remember when Astral told us in 2024 they would not sell out?<p>It was VC owned from the start, not a community project.
    • fhn17 hours ago
      everybody sells out at the right price. You&#x27;re a sellout just by working for someone.
      • nurettin17 hours ago
        By sellout they mean someone breaking promises for money. Not someone who is selling things&#x2F;skills&#x2F;time for money.
      • wpietri17 hours ago
        Nope. Getting paid and selling out are distinct things. It depends on whether your integrity is included in the sale price.
  • globular-toast16 hours ago
    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&#x27;ve been watching the releases and it&#x27;s pretty obvious there&#x27;s a lot of &quot;AI assisted&quot; development going on. Kinda funny that they&#x27;re using AI to make a tool which is pointless because of AI.
    • q4y2u35uk15 hours ago
      &gt; pretty obvious there&#x27;s a lot of &quot;AI assisted&quot; development going on<p>I don&#x27;t think it&#x27;s that bad? They don&#x27;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&#x27;s true of every project still developed these days. Compared to projects like Bun, the AI usage seems perfectly responsible.
    • edstarch16 hours ago
      But type checking is useful to AI?
      • ocamoss15 hours ago
        I think the IDE part of it is less important now, since AI generally isn&#x27;t trained to use&#x2F;doesn&#x27;t need to use a language server.
        • alexwaygood15 hours ago
          I think it depends on whether you&#x27;re working on a project where you&#x27;re ready to fully cede control to AI agents, or whether you&#x27;re still interested in reviewing&#x2F;understanding the code your agents are writing.<p>For me personally, it&#x27;s very much the latter -- I extensively review the code my agents write when working on ty. It&#x27;s fantastic that the codex app, for example, now allows me to use Language Server integrations when I&#x27;m reviewing the code that my agents have written. Goto definition, on-hover documentation, etc. in the codex app are all fantastic developments, and they&#x27;re all powered by language servers.<p>When I&#x27;m working on ty itself, I&#x27;m obviously using Rust language servers inside the codex app. But ty is now also the bundled language server for working on Python in the codex app!
          • ocamoss11 hours ago
            Ah yeah I think there&#x27;s some divergence of workflows now, compared to a few years ago when the IDE was more dominant.<p>Compared to before it feels like there are more ppl operating at what was previously an architect&#x27;s level of abstraction where they aren&#x27;t clicking thru and exploring most of the code that their team (of agents) produces.
          • killix14 hours ago
            [dead]
  • gebt12 hours ago
    Taiwan!
  • somesun9 hours ago
    now ai do all coding , LSP seems not useful as before.
    • rkangel2 hours ago
      If that&#x27;s the case, then why does claude request the Pyright LSP plugin to help navigate code?
  • sumwise15 hours ago
    [flagged]
    • pratzc0714 hours ago
      Do people write code these days in the year of our lord of AI agents.
      • __mharrison__11 hours ago
        AI writes my code.. But it also writes my Python types and checks them with ty.
      • prollings13 hours ago
        yes. but on a similar note: who you&#x27;re responding to doesn&#x27;t appear to have even written their own comment.
      • IshKebab13 hours ago
        I just tell Claude &quot;add a parameter to this function called foo with type int, and change it to return a + foo instead of a&quot;. It&#x27;s the future! I&#x27;m only semi joking.