Release Notes
Bug fixes
- Avoid duplicate diagnostic when reporting errors in unpacked assignments (#18897)
- Fix panics when "pulling types" for
ClassVar
orFinal
parameterized with >1 argument (#18824). These could cause issues when hovering over symbols in an IDE.
Improved modeling of Python runtime semantics
- Add support for
@staticmethod
s (#18809) - Discover implicit class attribute assignments in
@classmethod
-decorated methods. Recognize that assignments in the body of a@staticmethod
-decorated method are never instance attributes (#18587) - Report when a dataclass contains more than one
KW_ONLY
field (#18731)
Type narrowing improvements
- Ty will now perform
isinstance()
andissubclass()
narrowing when the second argument is a union type, intersection type orTypeVar
type (#18900) - Ty now narrows types in comprehensions and generator expressions (#18934)
- Understand two
NominalInstanceType
s as disjoint types if attempting to use multiple inheritance with their underlying classes would result in an instance memory layout conflict (#18864)
Other typing semantics features
- Support "mixed" tuples such as
tuple[int, *tuple[str, ...]]
(#18600, #18901) - Support type inference for subscript expressions on union types (#18846)
- Introduce a new subtyping framework in which gradual types can participate, allowing for more advanced union type simplification (#18799)
- Surface the matched overload directly when reporting a diagnostic for an invalid call to an overloaded function (#18452)
Improvements to server autocompletions
- Add completions for
from module import <CURSOR>
(#18830) - Enforce sort order of completions (#18917)
- Include imported sub-modules as attributes on modules for completions (#18898)
Configuration
- Anchor all
src.exclude
patterns, for consistency withsrc.include
patterns (#18685) - Change
environment.root
to accept multiple paths (#18913) - Rename
src.root
setting toenvironment.root
(#18760) - Support
--python=<symlink to executable>
(#18827)
Contributors
- @BurntSushi
- @InSyncWithFoo
- @suneettipirneni
- @AlexWaygood
- @dhruvmanila
- @sharkdp
- @MichaReiser
- @med1844
- @dcreager
- @carljm
Install ty 0.0.1-alpha.12
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/ty/releases/download/0.0.1-alpha.12/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.12/ty-installer.ps1 | iex"