github astral-sh/ty 0.0.1-alpha.27

pre-release21 hours ago

Release Notes

Released on 2025-11-18.

Bug fixes

  • Fix panic for cyclic star imports (#21428)
  • Fix crashes when using a homebrew Python install (#21405)
  • Fix incorrect inference of enum.auto() for enums with non-int mixins, and imprecise inference of enum.auto() for single-member enums (#20541)
  • Fix global symbol lookup from eagerly executed scopes such as comprehensions and classes (#21317)
  • Fix false positive for instance attributes that are declared as Final in the class body but have their value assigned in the class's __init__ method (#21158)
  • Use the return type of __get__ for descriptor lookups even when __get__ is called with incorrect arguments (#21424)
  • Consider parameters being declared global a syntax error (#21312)

Type inference

  • Support typing.NewType (#21157)
  • Support Callable in implicit type aliases (#21496)
  • Support typing.Union in implicit type aliases (#21363)
  • Precise inference for generator expressions (#21437)
  • Support storing attributes in comprehension scopes (#20856)
  • Support isinstance() and issubclass() narrowing when the second argument is a typing.py stdlib alias (#21391)
  • Support type[…] and Type[…] in implicit type aliases (#21421)
  • Support attribute-expression TYPE_CHECKING conditionals (#21449)
  • Support class-arguments for dataclass transformers (#21457)
  • Support legacy typing special forms in implicit type aliases (#21433)
  • Support stringified annotations in value-position Annotated instances (#21447)
  • Support all parameters of dataclass transforms (#21474)
  • Support __hash__ semantics and unsafe_hash for dataclasses (#21470)
  • Improve handling of version-specific features of dataclasses (#21453)
  • Correctly infer the specialization of a non-invariant PEP-695 generic class that has an annotated self parameter in its __init__ method (#21325)
  • Improve use of type context when inferring the result of a generic constructor call (#20933, #21442)
  • Improve use of type context when inferring the result of a generic call expression (#21210)
  • Improve heuristics used to decide when it is appropriate to "promote" a Literal type such as Literal[42] to its instance supertype (in this case, int) when solving type variables (#21439)
  • Improve use of type context to infer conditional expressions (#21443)
  • Make __getattr__ available for ModuleType instances (#21450)
  • Introduce implicit local variables for from imports of submodules in __init__.py(i) (#21173)
  • Make implicit submodule locals only occur in global scope of an __init__.py(i) (#21370)
  • Make implicit submodule locals also occur for absolute from imports in __init__.py(i) files (#21372)
  • Consider from thispackage import y a re-export of y in __init__.pyi (#21387)
  • Allow PEP-604 unions in stubs and TYPE_CHECKING blocks prior to 3.10 (#21379)
  • Ensure annotation/type expressions in stub files are always deferred (#21401, #21456)
  • Silence false-positive diagnostics when using typing.Dict or typing.Callable as the second argument to isinstance() (#21386)
  • Sync vendored typeshed stubs (#21466). Typeshed diff

LSP server

  • Support for notebooks in VS Code (#21175)
  • Fix goto-definition for float and complex in type annotation positions (#21388)
  • Support goto-definition on call argument inlay hints (#20349)
  • Add more keywords to scope-based completions (#21383)
  • Add synthetic members to completions on dataclasses (#21446)
  • Only suggest the import keyword in autocompletions for from <name> <CURSOR> statements (#21291)
  • Suppress completion suggestions following as tokens (#21460)
  • Suppress invalid suggestions in import statements (#21484)
  • Suppress redundant inlay hints for function args (#21365)
  • Suppress some trivial expression inlay hints (#21367)
  • Suppress inlay hints for +1 and -1 (#21368)
  • Improve semantic token classification for names (#21399)
  • Classify parameter declarations as definitions when computing semantic tokens (#21420)

Diagnostics

  • Better invalid-assignment diagnostics (#21476)
  • Better concise diagnostic messages (#21498)
  • Improve subscript assignment diagnostics (#21411, #21452)
  • Improve diagnostic range for non-subscriptable diagnostics (#21461)
  • Improve diagnostics for invalid exceptions (#21475)
  • Add hyperlinks to rule codes in CLI (#21502)

Performance improvements

  • Cache computation of dataclass/NamedTuple/TypedDict fields (#21512)
  • Faster subscript assignment checks for (unions of) TypedDicts (#21378)
  • Reduce memory allocations for string-literal types (#21497)

Contributors

Install ty 0.0.1-alpha.27

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/ty/releases/download/0.0.1-alpha.27/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.27/ty-installer.ps1 | iex"

Download ty 0.0.1-alpha.27

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.