github astral-sh/ty 0.0.110

2 hours ago

Release Notes

Released on 2026-11-25.

Bug fixes

  • Avoid long type-checking delays in nested generic calls where a child argument can match both a type variable and a parameterized type, such as T | Tree[T]. (#30847)
  • Infer more precise return types when a generic argument can match multiple members of a union. For example, passing [1] to a function with parameter type T | list[T] and return type list[T] can now infer list[int] when that choice fits the other arguments and the expected return type. (#30847)
  • Use the types of other operands or branches when inferring fresh collection literals in boolean and conditional expressions. If values is list[int] | None, ty now accepts appending 1 to the result of values or [None] and still rejects appending None. (#30911)
  • Narrow types using built-in list equality in comparison and membership checks. For example, value in ("all", "open") now narrows str | list[str] to the two string literals under the default equality settings. The change also covers != for built-in lists and dictionaries, while respecting custom comparison methods and analysis.strict-equality-semantics. (#30762)
  • Restore editor folding for indented # region and # endregion comments, such as those inside a function. (#30893)

Diagnostic improvements

  • Explain in incompatible-property-override and incompatible-mutable-override diagnostics when an attribute has neither a matching __slots__ entry nor an instance dictionary. When a custom __setattr__ rejects writes of a type accepted by the base class, point to that method. (#29531)

Configuration changes

  • Opt in to uv discovery of your workspace, Python environment, and dependency metadata with the preview setting project-manager.project = "uv". It requires uv 0.12.3 or later and an already synchronized environment. The default is "none", and an explicit TY_UV takes precedence. (#30568)

Performance improvements

  • Prevent runaway memory use during generic call inference, such as when passing a union of string literals to pandas.Series. (#30842)
  • Discover files faster when many paths are passed explicitly to ty check --force-exclude. (#30635)
  • Report errors faster when a call fails for several members of a large union by reusing the formatted union across diagnostics at that call site. (#30857)
  • Index bundled stubs faster by resolving Python version checks and, when targeting a specific platform, platform checks up front. LiteralString inlay hints can also link to the declaration for the configured Python version. (#30863)
  • Determine whether classes are abstract faster when they contain plain assignments or methods with decorators that preserve concreteness, such as contextlib.contextmanager. (#30804, #30903)
  • Speed up repeated member lookups on the same class, including across different specializations of a generic class. (#30870)
  • Resolve built-in names faster by reusing lookups of the standard builtins module and the project’s optional __builtins__ module. (#30884)
  • Speed up lookups of name uses and their enclosing scopes. (#30886)
  • Reduce the overhead of reusing results when combining conditions for type narrowing and reachability analysis. (#30885)
  • Reduce the overhead of simple type compatibility checks, such as comparing identical types, by allocating constraint solver storage only when needed. (#30887)
  • Speed up generic call inference by skipping unused explanations when candidate type arguments violate their bounds. (#30864)
  • Reduce the overhead of inferring a call argument against a single expected parameter type. (#30883)

Core type checking

  • Check calls to __attrs_init__ on attrs classes declared with init=False, using the same field parameters as a generated __init__. (#30852)
  • Allow callers to omit an attrs constructor argument when the field’s default is supplied by a method decorated with @field_name.default. (#30872)
  • Avoid overly narrow return types for generic calls in assignments annotated with unions. For example, a call that returns the first item of a list or None can infer int | None from an assignment annotation when the list contains an Any value and ty previously inferred only None. (#30480)
  • Show the type inferred from the literal itself in invalid-assignment diagnostics for incompatible collections. For example, x: list[int] = ["a"] now reports list[str] as the source type. (#30478)
  • Use uv’s versioned preview format to load workspace and script metadata, with a fallback to the unversioned request on uv 0.12.3 through 0.13.6. (#30529)

Contributors

Install ty 0.0.110

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://releases.astral.sh/github/ty/releases/download/0.0.110/ty-installer.sh | sh

Install prebuilt binaries via powershell script

powershell -ExecutionPolicy Bypass -c "irm https://releases.astral.sh/github/ty/releases/download/0.0.110/ty-installer.ps1 | iex"

Download ty 0.0.110

File Platform Checksum
ty-aarch64-apple-darwin.tar.gz Apple Silicon macOS checksum
ty-x86_64-apple-darwin.tar.gz Intel macOS checksum
ty-aarch64-pc-windows-msvc.zip ARM64 Windows checksum
ty-i686-pc-windows-msvc.zip x86 Windows checksum
ty-x86_64-pc-windows-msvc.zip x64 Windows checksum
ty-aarch64-unknown-linux-gnu.tar.gz ARM64 Linux checksum
ty-i686-unknown-linux-gnu.tar.gz x86 Linux checksum
ty-powerpc64le-unknown-linux-gnu.tar.gz PPC64LE Linux checksum
ty-riscv64gc-unknown-linux-gnu.tar.gz RISCV Linux checksum
ty-s390x-unknown-linux-gnu.tar.gz S390x Linux checksum
ty-x86_64-unknown-linux-gnu.tar.gz x64 Linux checksum
ty-armv7-unknown-linux-gnueabihf.tar.gz ARMv7 Linux checksum
ty-aarch64-unknown-linux-musl.tar.gz ARM64 MUSL Linux checksum
ty-i686-unknown-linux-musl.tar.gz x86 MUSL Linux checksum
ty-x86_64-unknown-linux-musl.tar.gz x64 MUSL Linux checksum
ty-arm-unknown-linux-musleabihf.tar.gz ARMv6 MUSL Linux (Hardfloat) checksum
ty-armv7-unknown-linux-musleabihf.tar.gz ARMv7 MUSL Linux checksum

Verifying GitHub Artifact Attestations

The artifacts in this release have attestations generated with GitHub Artifact Attestations. These can be verified by using the GitHub CLI:

gh attestation verify <file-path of downloaded artifact> --repo astral-sh/ty

You can also download the attestation from GitHub and verify against that directly:

gh attestation verify <file-path of downloaded artifact> --bundle <file-path of downloaded attestation>

Don't miss a new ty release

NewReleases is sending notifications on new releases.