Release Notes
Released on 2025-12-03.
Bug fixes
- Fix exhaustiveness checking for
matchstatements over unions of generic instance types (#21726) - Don't introduce invalid syntax when autofixing
override-of-final-method(#21699) - Suppress false positives when
dataclasses.dataclass(...)(cls)is called imperatively (#21729) - Fix false positives for
class F(Generic[*Ts]): ...(#21723) - Don't confuse multiple occurrences of
typing.Selfwhen binding bound methods (#21754) - Fix subtyping between
type[T]and a union type, whereTis a type variable in scope (#21740) - Fix subtyping between
type[T]andU, whereTis a type variable in scope andUis a type variable not in scope (#21766) - Fix false positives for
type[tuple[...]](#21652)
Memory usage improvements
- Significantly reduce memory usage (especially when ty is used as an LSP server) by enabling least-recently-used (LRU) cache eviction for module ASTs (#21749)
LSP server
- Add code action to ignore diagnostic on the current line (#21595)
- Exclude
typing_extensionsfrom autocomplete suggestions unless it's really available (#21731) - Fix auto-import code action to handle pre-existing imports (#21733)
- Fix "find all references" for types defined in stub files (#21732)
- Fix "find all references" for symbols defined via aliased imports (#21736)
Improvements to handling of type aliases
- Default-specialize generic type aliases when they appear unspecialized in type expressions (#21765)
- Infer a type alias as being a generic type alias if it includes a type variable in its definition, even in cases where the value subscripted with the type variable is inferred as having a dynamic type such as
AnyorUnknown(#21730)
New NamedTuple diagnostics
- Detect
NamedTupleclasses that have field names starting with underscores, which is banned at runtime (#21697) - Add a diagnostic detecting overrides of prohibited
NamedTupleattributes (#21717) - Detect illegal uses of
super()in methods ofNamedTupleclasses (#21700)
Improvements to existing diagnostics
- Improve diagnostics for unsupported comparison operations (#21737)
- For
invalid-type-argumentsdiagnostics, show the user where the type variable was defined (#21727) - Extend
invalid-explicit-overrideto also cover properties decorated with@overridethat do not override anything (#21756) - Improve
@override,@finaland Liskov checks in cases where there are multiple reachable definitions (#21767)
Contributors
- @MichaReiser
- @charliermarsh
- @dcreager
- @carljm
- @AlexWaygood
- @BurntSushi
- @ibraheemdev
- @woodruffw
- @sharkdp
Install ty 0.0.1-alpha.30
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/ty/releases/download/0.0.1-alpha.30/ty-installer.sh | shInstall prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/astral-sh/ty/releases/download/0.0.1-alpha.30/ty-installer.ps1 | iex"