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
Divergenttypes out of intersections types (#21253) - Fix merging of
--excludeCLI flag andsrc.excludeconfig-file setting (#21341)
Type inference
- Infer type of
selffor 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, andAnnotated(#21195, #21296, #21321) dictis not assignable toTypedDict(#21238)- Allow values of type
Nonein type expressions (#21263) - Add narrowing for
isinstance()andissubclass()checks that use PEP-604 unions (#21334) - Do not promote
Literaltypes 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
matchstatements (#21150) - Improve understanding of disjointness for
@finalclasses (#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.Literalwith 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()andissubclass()calls that use invalid PEP-604 unions for their second argument (#21343) - Don't assume in diagnostic messages that a
TypedDictkey error is about subscript access (#21166)
Other changes
- Consistently wrap tokens in parser diagnostics in
backticksinstead of 'quotes' (#21163) - Discover the
site-packagesdirectory from the environment that ty is installed in (#21286), improving the ergonomics ofuvx ty check - Support implicit imports of submodules in
__init__.pyi(#20855) - Use "cannot" consistently over "can not" in diagnostics (#21255)
- Resolve
from foo import barto thefoo.barsubmodule rather than using the__getattr__function infoo/__init__.py(in situations where they both exist)(#21260)
Contributors
- @MatthewMckee4
- @dhruvmanila
- @sharkdp
- @Gankra
- @saada
- @zanieb
- @MichaReiser
- @ibraheemdev
- @AlexWaygood
- @lucach
- @mtshiba
- @carljm
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 | shInstall 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"