Release 0.0.1-alpha.22 · astral-sh/ty (original) (raw)
Release Notes
Released on 2025-10-10.
Bug fixes
- Enforce that
typing_extensionsmust come from a stdlib search path. This fixes a panic that could occur with a confusing backtrace if theextra-pathssetting was incorrectly used to point to a virtual environment (#20715) - Fix server panic when opening a project located at
/in the file system (#20684) - Fix panics when using
--output-format=gitlabin CI environments (#20550) - Fix stack overflows that could occur when attempting to determine if a recursive
NamedTupletype was disjoint from another type (#20538) - Fix panics in type inference when legacy TypeVars had bounds, constraints, or defaults that cyclically referred back to the TypeVar definition (directly or indirectly) (#20598)
- Fix situations where a panic during resolution of type-checker query cycles would manifest in a hang (#20577)
- When analyzing a .py file, do not error if there's also a .pyi for that module (#20461)
- Recognise that the runtime object
typing.Protocolis an instance of_ProtocolMeta(#20488) - Fix logic that attempted to determine whether a user had explicitly activated a Conda environment, which has implications for the search paths ty uses for module resolution (#20675)
- Fix false negatives when iterables with the wrong type are unpacked into a function with a
*argsvariadic parameter (#20511)
Support for Python 3.14
- Use 3.14 as the default version (#20725, #20759, #20760)
- Annotations are deferred by default for 3.14+ (#20799)
- Fix false positives when accessing
__annotate__(Py3.14+) or__warningregistry__as a module global (#20154)
Improvements to TypeVar solving and inference of generic types
- Improve solving of a type variable
Tif it appears in a union with non-TypeVars (T | None,T | str | None, etc.) (#20749) - More precise type inference for dictionary literals (#20523)
- When solving type variables, use type context to inform whether
Literaltypes should be promoted to instance types (#20776) - Use annotated parameters as type context when solving type variables (#20635)
- Correctly infer the return type of method calls when the method is annotated as returning
Self(#20517, #20754) - Use type context for inference of generic function calls (#20476)
- Use
C[T]instead ofC[Unknown]for the upper bound ofSelf(#20479)
Improvements to assignability, subtyping, and union simplification
- Fix overly strict assignability implementation for intersections with negated gradual elements (#20773)
- Ensure that
C[Any]is understood as a subtype ofC[object]ifCis a covariant generic class (#20592) - Ensure that
~Tis never considered to be assignable toTwhereTis a type variable (#20606) - Improve assignability/subtyping between two protocol types (#20368)
- Simplify
Any | (Any & T)toAny(#20593) - Optimise and generalise union/intersection simplification (#20602)
- Make protocol satisfiability checks more principled when a protocol has a method member that is generic over type variables scoped to the function (#20568)
- Fix subtyping of invariant generics specialized with
Any, ensuring that (for example)list[Any]is not considered a subtype oflist[Any](#20650)
Server
- Add LSP debug information command (#20379)
- Add support for inlay hints on attribute assignment (#20485)
Improvements to diagnostics
- Improve diagnostics when a positional-only parameter is passed using a keyword argument (#20495)
- Improve disambiguations of class names in diagnostics (#20603, #20756)
- Improve diagnostics for bad
@overloaddefinitions (#20745) - Truncate type display for long unions in some situations (#20730)
- Rename "possibly unbound" diagnostics to "possibly missing" (#20492)
Improvements to enum support
Improvements to ty's @overload implementation
- Support single-starred argument for overload call (#20223)
- Filter overloads using variadic parameters (#20547)
Other typing semantics and features
- Do not union the inferred type of a module-global symbol with
Unknownfor the symbol's type when accessed from external scopes (#20664) - Ensure that class objects are understood as callable even if they do not override
object.__new__orobject.__init__(#20521) - Add support for
**kwargs(#20430) - Ensure first-party module-resolution search paths always appear in a sensible order (#20629)
- Respect
dataclass_transformparameters for metaclass-based models (#20780) - Sync vendored typeshed stubs (#20658). Typeshed diff
- Bring ty's
TypeIsnarrowing behaviour closer to ty's narrowing behaviour forisinstance()checks. (#20591) dataclass_transform: Supportfrozen_defaultandkw_only_default(#20761)- Allow any string
Literaltype expression as a key when constructing aTypedDict(#20792) - Add
--venvas an alias to--pythonon the command line (#20718) - Add search paths listed in
PYTHONPATHto search paths used for ty's module resolution (#20441, #20490)
Contributors
- @thejchap
- @mtshiba
- @Danielkonge
- @dcreager
- @MatthewMckee4
- @Gankra
- @BurntSushi
- @carljm
- @dhruvmanila
- @sharkdp
- @mmlb
- @fgiacome
- @Guillaume-Fgt
- @AlexWaygood
- @Renkai
- @InvalidPathException
- @ibraheemdev
- @fatelei
- @github-actions
- @MichaReiser
- @ntBre
- @danparizher
Install ty 0.0.1-alpha.22
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/ty/releases/download/0.0.1-alpha.22/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.22/ty-installer.ps1 | iex"