Recent submissions

Comment · 7 months ago
We provide this diagnostic in ty (https://docs.astral.sh/ty/reference/rules/#possibly-unresolv...), but it's disabled by default because it can have false positives in many scenarios where the code works at runtime (this is true also in the type checkers that enable it by default). A typical example is code like

  def _(flag: bool):
    if flag:
      x = True
    ...
    if flag:
      read(x)
But it's easy to turn the rule on if you want it:

  [tool.ty.rules]
  possibly-unresolved-reference = "error"
Comment · 10 months ago
https://forum.cursor.com/t/newly-published-extensions-appear... suggests that there's some kind of delayed daily update for new VSCode extension versions to become available to Cursor? It seems likely that's what is happening here, since ty-vscode 0.0.2 was only published an hour or two ago.
Comment · 10 months ago
I can reproduce this; we're looking into it.
Comment · 10 months ago
We'll be adding ourselves to that table soon. We'll have some work to catch up with pyright on conformance, but that's what the time between now and stable release is for.
Comment · 1 year ago
There are ways to type invariant generics more precisely that still meet the gradual guarantee. E.g.:

  x = []  # list[Unknown]
  x.append(A())  # list[Unknown | A]
  takes_list_of_a_or_b(x)  # list[A | B]
We haven't decided yet if this is what we want to do, though. It's also possible that we may decide to compromise on the gradual guarantee in this area. It's not an ironclad rule for us, just something we're considering as a factor.
Comment · 1 year ago
ty also implements gradual set-theoretic types, and can represent "ranged" dynamic types (as intersections or unions with Any/Unknown). We don't currently refine dynamic type based on all uses, as suggested here, though we've considered something very much like this for invariant generics.

In your example, wouldn't `none()` be a type for `x` that satisfies both `Integer.to_string(x)` and `Atom.to_string(x)`? Or do you special-case `none()` and error if it occurs?

Comment · 1 year ago
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.
Comment · 1 year ago
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.
Comment · 1 year ago
Yes, thank you for your graciousness and generosity, very much appreciated.
Comment · 1 year ago
I knew we left something important out of that onboarding document
Comment · 1 year ago
Not the same headline functionality yet, no. At the moment all we support is diagnostics (some of which may be wrong) and go-to-type-definition. More will come.
Comment · 1 year ago
Yes, we've talked; I know a number of the pyrefly devs well. Ty had already been months in development when pyrefly development started. We discussed collaboration, but they decided they needed to do their own thing in order to move quickly and ensure it would serve their needs, which is totally reasonable.
Comment · 1 year ago
There's a good chance many of the errors we emit are incorrect, at this stage. Lots to do still!
Comment · 1 year ago
The current version can handle importing pydantic without error just fine, but it probably can't find your virtualenv, so it doesn't know what third-party dependencies you have installed. Ty will discover your venv if it is in `.venv` in the project directory; otherwise you can help it out with the `--python` CLI flag.
Comment · 1 year ago
Yes, red knot was the internal development code name; ty is the actual name.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton