Release 0.0.1-alpha.19 · astral-sh/ty (original) (raw)
Release Notes
Bug fixes
- Fix false-positive diagnostics if a function parameter is annotated with
type[P]wherePis a protocol class (#19947) - Fix ANSI colors in terminal output on old Windows terminals (#19984)
- Fix protocol interface inference for protocols in stub files with
ClassVarmembers and "subprotocols" that extend other protocols (#19950) - Fix inference of equality comparisons between enum members (#19666)
- Remove incorrect type narrowing for
if type(x) is C[int](#19926) - Improve detection of
TypeErrors resulting from protocol classes illegally inheriting from non-protocol classes (#19941). We previously detected this error, but only when the protocol class illegally inherited from a non-generic class or an unspecialized generic class. We now also detect it when the protocol class inherits from a specialized generic class. - Fix incorrectly precise type inference in some situations involving nested scopes (#19908)
- Fix unpacking a type alias with a precise tuple spec (#19981)
NamedTuple semantics improvements
- Synthesize read-only properties for all declared members on
NamedTupleclasses (#19899) - Allow any instance of a
NamedTupleclass to be passed to a function parameter annotated withtyping.NamedTuple(#19915) - Detect
NamedTupleclasses where fields without default values illegally follow fields with default values (#19945). This causesTypeErrorto be raised at runtime. - Detect illegal multiple inheritance with
NamedTuple(#19943). This causesTypeErrorto be raised at runtime.
Other typing and semantics improvements
- Add support for stubs packages with
partialin theirpy.typedfiles (#19931) - Look for
site-packagesdirectories in<sys.prefix>/lib64/as well as<sys.prefix>/lib/on non-Windows systems (#19978). This change fixes a number ofunresolved-importfalse-positive diagnostics reported by Poetry users. - Add diagnostics for invalid
awaitexpressions (#19711) - Add
else-branch narrowing forif type(a) is AwhenAis@final(#19925) - Improve solving of typevars with defaults, and
typing.Self(#19786) - Support the
kw_onlyparameter fordataclasses.dataclass()anddataclasses.field()(#19677) - Sync vendored typeshed stubs (#19923). Typeshed diff.
Server improvements
- Improve goto/hover for definitions (#19976)
Performance improvements
- Short-circuit a server inlay hints request if all settings under
ty.inlayHintsare disabled (#19963) - Speedup server tracing checks (#19965)
- Add caching to logic for inferring whether a class is a
NamedTuple, a dataclass or aTypedDict(#19912) - Speedup project file discovery (#19913)
Contributors
- @dcreager
- @MichaReiser
- @sharkdp
- @github-actions
- @mtshiba
- @theammir
- @AlexWaygood
- @thejchap
- @Gankra
- @MatthewMckee4
- @carljm
Install ty 0.0.1-alpha.19
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/ty/releases/download/0.0.1-alpha.19/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.19/ty-installer.ps1 | iex"