github astral-sh/ty 0.0.1-alpha.26

pre-release12 hours ago

Release Notes

Released on 2025-11-10.

Bug fixes

  • Language server: For semantic tokens, fix range filtering for tokens starting at the end of the requested range (#21193)
  • Fix panic due to simplifying Divergent types out of intersections types (#21253)
  • Fix merging of --exclude CLI flag and src.exclude config-file setting (#21341)

Type inference

  • Infer type of self for decorated methods and properties (#21123)
  • Add support for properties that return Self (#21335)
  • Understand legacy and PEP 695 ParamSpec (#21139)
  • Type inference for comprehensions (#20962)
  • Reachability and narrowing for enum methods (#21130)
  • Implicit type aliases: Support for PEP 604 unions, Literals, Optional, and Annotated (#21195, #21296, #21321)
  • dict is not assignable to TypedDict (#21238)
  • Allow values of type None in type expressions (#21263)
  • Add narrowing for isinstance() and issubclass() checks that use PEP-604 unions (#21334)
  • Do not promote Literal types when solving type variables in contravariant positions (#21164, astral-sh/ruff#21171))
  • Fix lookup of __new__ methods on instances (#21147)
  • Fix narrowing of generic classes in class patterns for match statements (#21150)
  • Improve understanding of disjointness for @final classes (#21167)
  • Fix the inferred signature of the synthesized __init__ method of a non-dataclass inheriting from a generic dataclass (#21159)
  • Improve exhaustiveness analysis for type variables with bounds or constraints (#21172)
  • Prefer exact matches when solving constrained type variables (#21165)
  • Simplify unions containing multiple type variables during inference (#21275)
  • Use the declared attribute type when inferring union attribute assignments (#21170)
  • Sync vendored typeshed stubs (#21178). Typeshed diff
  • Use declared attribute types as type context when solving type variables (#21143)
  • Don't union in the inferred type of a parameter's default value when inferring the type of an annotated parameter (#21208)
  • Support subscripting typing.Literal with a type alias (#21207)

LSP server

  • Don't provide completions when in a class or function definition (#21146)
  • For autocompletions, favor symbols defined in the current file over auto-imported symbols (#21194) and builtin symbols (#21285)

Diagnostics

  • Add diagnostics for isinstance() and issubclass() calls that use invalid PEP-604 unions for their second argument (#21343)
  • Don't assume in diagnostic messages that a TypedDict key error is about subscript access (#21166)

Other changes

  • Consistently wrap tokens in parser diagnostics in backticks instead of 'quotes' (#21163)
  • Discover the site-packages directory from the environment that ty is installed in (#21286), improving the ergonomics of uvx ty check
  • Support implicit imports of submodules in __init__.pyi (#20855)
  • Use "cannot" consistently over "can not" in diagnostics (#21255)
  • Resolve from foo import bar to the foo.bar submodule rather than using the __getattr__ function in foo/__init__.py (in situations where they both exist)(#21260)

Contributors

Install ty 0.0.1-alpha.26

Install prebuilt binaries via shell script

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

Install prebuilt binaries via powershell script

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

Download ty 0.0.1-alpha.26

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-powerpc64-unknown-linux-gnu.tar.gz PPC64 Linux checksum
ty-powerpc64le-unknown-linux-gnu.tar.gz PPC64LE 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

Don't miss a new ty release

NewReleases is sending notifications on new releases.