mirror of
https://github.com/astral-sh/ty.git
synced 2025-12-23 08:48:09 +00:00
108 KiB
108 KiB
Changelog
0.0.1-alpha.27
Released on 2025-11-18.
Bug fixes
- Fix panic for cyclic star imports (#21428)
- Fix crashes when using a homebrew Python install (#21405)
- Fix incorrect inference of
enum.auto()for enums with non-intmixins, and imprecise inference ofenum.auto()for single-member enums (#20541) - Fix global symbol lookup from eagerly executed scopes such as comprehensions and classes (#21317)
- Fix false positive for instance attributes that are declared as
Finalin the class body but have their value assigned in the class's__init__method (#21158) - Use the return type of
__get__for descriptor lookups even when__get__is called with incorrect arguments (#21424) - Consider parameters being declared
globala syntax error (#21312)
Type inference
- Support
typing.NewType(#21157) - Support
Callablein implicit type aliases (#21496) - Support
typing.Unionin implicit type aliases (#21363) - Precise inference for generator expressions (#21437)
- Support storing attributes in comprehension scopes (#20856)
- Support
isinstance()andissubclass()narrowing when the second argument is atyping.pystdlib alias (#21391) - Support
type[…]andType[…]in implicit type aliases (#21421) - Support attribute-expression
TYPE_CHECKINGconditionals (#21449) - Support class-arguments for dataclass transformers (#21457)
- Support legacy
typingspecial forms in implicit type aliases (#21433) - Support stringified annotations in value-position
Annotatedinstances (#21447) - Support all parameters of dataclass transforms (#21474)
- Support
__hash__semantics andunsafe_hashfor dataclasses (#21470) - Improve handling of version-specific features of dataclasses (#21453)
- Correctly infer the specialization of a non-invariant PEP-695 generic class that has an annotated
selfparameter in its__init__method (#21325) - Improve use of type context when inferring the result of a generic constructor call (#20933, #21442)
- Improve use of type context when inferring the result of a generic call expression (#21210)
- Improve heuristics used to decide when it is appropriate to "promote" a
Literaltype such asLiteral[42]to its instance supertype (in this case,int) when solving type variables (#21439) - Improve use of type context to infer conditional expressions (#21443)
- Make
__getattr__available forModuleTypeinstances (#21450) - Introduce implicit local variables for
fromimports of submodules in__init__.py(i)(#21173) - Make implicit submodule locals only occur in global scope of an
__init__.py(i)(#21370) - Make implicit submodule locals also occur for absolute
fromimports in__init__.py(i)files (#21372) - Consider
from thispackage import ya re-export ofyin__init__.pyi(#21387) - Allow PEP-604 unions in stubs and
TYPE_CHECKINGblocks prior to 3.10 (#21379) - Ensure annotation/type expressions in stub files are always deferred (#21401, #21456)
- Silence false-positive diagnostics when using
typing.Dictortyping.Callableas the second argument toisinstance()(#21386) - Sync vendored typeshed stubs (#21466). Typeshed diff
LSP server
- Support for notebooks in VS Code (#21175)
- Fix goto-definition for
floatandcomplexin type annotation positions (#21388) - Support goto-definition on call argument inlay hints (#20349)
- Add more keywords to scope-based completions (#21383)
- Add synthetic members to completions on dataclasses (#21446)
- Only suggest the
importkeyword in autocompletions forfrom <name> <CURSOR>statements (#21291) - Suppress completion suggestions following
astokens (#21460) - Suppress invalid suggestions in
importstatements (#21484) - Suppress redundant inlay hints for function args (#21365)
- Suppress some trivial expression inlay hints (#21367)
- Suppress inlay hints for
+1and-1(#21368) - Improve semantic token classification for names (#21399)
- Classify parameter declarations as definitions when computing semantic tokens (#21420)
Diagnostics
- Better invalid-assignment diagnostics (#21476)
- Better concise diagnostic messages (#21498)
- Improve subscript assignment diagnostics (#21411, #21452)
- Improve diagnostic range for
non-subscriptablediagnostics (#21461) - Improve diagnostics for invalid exceptions (#21475)
- Add hyperlinks to rule codes in CLI (#21502)
Performance improvements
- Cache computation of dataclass/NamedTuple/TypedDict fields (#21512)
- Faster subscript assignment checks for (unions of)
TypedDicts (#21378) - Reduce memory allocations for string-literal types (#21497)
Contributors
- @thejchap
- @mtshiba
- @ibraheemdev
- @Gankra
- @charliecloudberry
- @lucach
- @AlexWaygood
- @MichaReiser
- @Glyphack
- @dcreager
- @saada
- @11happy
- @oconnor663
- @MatthewMckee4
- @BurntSushi
- @RasmusNygren
- @sharkdp
0.0.1-alpha.26
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, https://github.com/astral-sh/ruff/pull/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.Literal with a type alias (#21207)
LSP server
- Don't provide completions when in a class or function definition (#21146)
- Favor symbols defined in the current file over 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
0.0.1-alpha.25
Released on 2025-10-29.
Bug fixes
- Fix bug where ty would think all types had an
__mro__attribute (#20995) - Fix rare panic with highly cyclic
TypeVardefinitions (#21059) - Fix infinite recursion with generic type aliases (#20969)
- Add missing newline before first diagnostic in CLI output (#21058)
- Make the ty server's auto-import feature skip symbols in the current module (#21100)
- Don't provide goto-definition for definitions which are not reexported in builtins (#21127)
- Avoid duplicate diagnostics during multi-inference of standalone expressions (#21056)
Type inference and diagnostics
- Use constructor parameter types as context to inform solving type variables (#21054)
- Consider
__len__when determining the truthiness of an instance of a tuple class or a@finalclass (#21049) - Delegate truthiness inference of an enum
Literaltype to its enum-instance supertype (#21060) - Improve
invalid-argument-typediagnostics where a union type was provided (#21044)
LSP server
- Suggest
type_check_onlyitems last in completions (#20910) - Render
import <...>in completions when "label details" isn't supported (#21109) - Update workspace diagnostic progress every 50ms (#21019)
CLI
- Add
--no-progressoption to suppress the rendering of a progress bar (#21063)
Contributors
0.0.1-alpha.24
Released on 2025-10-23.
Breaking changes
- Rename
unknown-rulelint toignore-comment-unknown-rule(#20948)
Type inference and diagnostics
- Infer a type of
Selffor unannotatedselfparameters in methods (#20922) - Prefer the declared type over the inferred type for invariant collection literals (#20927)
- Use declared variable types as bidirectional type context for solving type variables (#20796)
- Support
dataclass_transformfor base class models (#20783) - Support dataclass-transform
field_specifiers(#20888) dataclass_transformsupport for fields with analias(#20961)- Add support for legacy namespace packages (#20897)
- Add suggestion to "unknown rule" diagnostics (#20948)
- Improve error messages for "unresolved attribute" diagnostics (#20963)
- Avoid unnecessarily widening generic specializations (#20875)
- Truncate
Literaltype display in some situations (#20928)
Bug fixes
- Fix panic involving cyclic
TypeVardefault (#20967) - Fix panic involving ever-growing default types (#20991)
- Fix panic involving infinitely expanding implicit attribute types (#20988)
- Fix autocomplete suggestions when the cursor is at the end of a file (#20993)
- Fix inconsistent highlighting of self (#20986)
- Fix out-of-order semantic token for function with regular argument after kwargs (#21013)
- Fix panic on recursive class definitions in a stub that use constrained type variables (#20955)
- Fix panic when attempting to validate the members of a protocol that inherits from a protocol in another module (#20956)
- Fix rare hang relating to multithreading (#21038)
- Fix non-deterministic overload function inference (#20966)
- Fix auto-import edits made by autocompletions for files with an existing
from __future__import (#20987)
LSP server
- Support goto-definition for binary and unary operators (#21001)
- Support goto-definition on vendored typeshed stubs (#21020)
- Provide completions on
TypeVars (#20943) - Display variance when hovering over type variables (#20900)
- Avoid sending an unnecessary "clear diagnostics" message for clients supporting pull diagnostics. (#20989)
Other changes
- Report
continueandbreakstatements outside loops as syntax errors (#20944)
Contributors
0.0.1-alpha.23
Released on 2025-10-16.
Bug fixes
- Fix handling of dataclass
field()s without default values (#20914) - Fix false-positive diagnostics on
super()calls (#20814, #20843) - Fix
matchpattern value narrowing to use equality semantics (#20882) - Fix "missing root" panic when handling completion requests (#20917)
- Fix overwriting of declared base class attributes through undeclared subclass members (#20764)
- Fix runaway execution time for mutually referential instance attributes (#20645)
CLI
- For
unresolved-importdiagnostics, limit the shown import paths to at most five, unless in verbose mode (#20912) - Write files that are slow to type check to log output (#20836)
- Remove "pre-release software" warning (#20817)
LSP server
- Improve ranking of autocomplete suggestions (#20807)
Type inference and diagnostics
- Use return type annotations as context for bidirectional type inference (#20528)
- Use bidirectional type context for
TypedDictconstruction (#20806) - Add support for unpacking of heterogeneous tuples in unions (#20377)
- Add a new diagnostic for generic classes that reference typevars from an enclosing scope (#20822)
- Add hint when accessing standard library module attributes that are not available on the configured Python version (#20909)
- Treat functions, methods, and dynamic types as function-like
Callables (#20842) - Treat
Callables as bound-method descriptors in special cases (#20802) - Treat
Callabledunder members as bound method descriptors (#20860) - Sync vendored typeshed stubs (#20876). Typeshed diff
Performance improvements
- Improve performance by caching union simplification type relations (#20477)
Contributors
- @mtshiba
- @AlexWaygood
- @ericmarkmartin
- @carljm
- @ntBre
- @sharkdp
- @BurntSushi
- @Gankra
- @MichaReiser
- @dcreager
0.0.1-alpha.22
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
0.0.1-alpha.21
Bug fixes
- Fix inference of constructor calls to generic classes that have explicitly annotated
selfparameters in their__init__methods (#20325) - Fix a stack overflow when computing completions for recursive types (#20354)
- Fix panic in
BoundMethodType::into_callable_type()(#20369) - Fix stack overflows in binary comparison inference (#20446)
- Fix many "too many cycle iterations" panics concerning recursive type aliases and/or recursive generics (#20359)
- Fix stack overflow involving subtype checks for recursive type aliases (#20259)
- Fix panic when inferring the type of an infinitely-nested-tuple implicit instance attribute (#20333)
Server
- Add autocomplete suggestions for unimported symbols (#20207, #20439)
- Include generated
NamedTuplemethods such as_make,_asdictand_replacein autocomplete suggestions (#20356)
Configuration
- Automatically add
python/toenvironment.rootif apython/folder exists in the root of a repository (#20263)
CLI
Typing semantics and features
- Add support for generic PEP-695 type aliases (#20219)
- Allow annotation expressions to be
ast::Attributenodes (#20413) - Allow protocols to participate in nominal subtyping as well as structural subtyping (#20314)
- Attribute access on top/bottom materializations (#20221)
- Bind
Selftype variables to the method, not the class (#20366) - Ensure various special-cased bound methods are understood as assignable to
Callable(#20330) - Ensure various special-cased builtin functions are understood as assignable to
Callable(#20331) - Fall back to
objectfor attribute access on synthesized protocols (#20286) - Fix signature of
NamedTupleLike._make(#20302) - Fix subtyping/assignability of function- and class-literal types to callback protocols (#20363)
- Implement the legacy PEP-484 convention for indicating positional-only parameters (#20248)
- Infer more precise types for collection literals (#20360)
- Make
TypeIsinvariant in its type argument (#20428) - Narrow specialized generics using
isinstance()(#20256) - Proper assignability/subtyping checks for protocols with method members (#20165)
- Reduce false positives for
ParamSpecs andTypeVarTuples (#20239) - Overload evaluation: retry parameter matching for argument type expansion (#20153)
- Simplify unions of enum literals and subtypes thereof (#20324)
- Support "legacy"
typing.Selfin combination with PEP-695 generic contexts (#20304) - Treat
Hashable, and similar protocols, equivalently toobjectfor subtyping/assignability (#20284) - Treat
__new__as a static method (#20212) TypedDict: Add support fortyping.ReadOnly(#20241)- Detect syntax errors stemming from
yield fromexpressions inside async functions (#20051) "foo".startswithis not an instance oftypes.MethodWrapperType(#20317)- Eliminate definitely-impossible types from union in equality narrowing (#20164)
- Infer more precise types for the
nameandvalueproperties on enum members (#20311) - Initial support for
slots=Truein dataclasses (#20278) - Improve type narrowing in situations involving nested functions (#19932)
- Support type aliases in binary comparison inference (#20445)
- Sync vendored typeshed stubs (#20394). Typeshed diff
Diagnostics
- Improve specialization-error diagnostics (#20326)
Contributors
- @thejchap
- @AlexWaygood
- @mtshiba
- @JelleZijlstra
- @ibraheemdev
- @TaKO8Ki
- @Glyphack
- @ericmarkmartin
- @Renkai
- @sharkdp
- @11happy
- @BurntSushi
- @carljm
- @dhruvmanila
- @github-actions
- @ntBre
0.0.1-alpha.20
Bug fixes
- Server: Cancel background tasks when shutdown is requested (#20039)
- Server: Close signature help after
)(#20017) - Server: Fix incorrect docstring in call signature completion (#20021)
- Fix 'too many cycle iterations' for unions of literals (#20137)
- Fix namespace packages that behave like partial stubs (#19994)
- Fix server hang (unchanged diagnostics) when changing file on Windows (#19991)
- Apply
KW_ONLYsentinel only to local fields (#19986) - Ignore field specifiers when not specified in
@dataclass_transform(#20002)
Server
- Add completion support for
importandfrom ... importstatements (#19883) - Add type as detail to completion items (#20047)
- Ask the LSP client to watch all project search paths (#19975)
- Fix incorrect inlay hint type (#20044)
- Update goto definition, goto declaration and hover to consider constructor method (
__init__) (#20014) - Add docstrings to completions based on type (#20008)
- Fix goto targets for keyword arguments in nested function calls (#20013)
- Introduce multiline pretty printer to render function signatures across multiple lines (#19979)
Configuration
- Distinguish base conda from child conda (#19990)
Typing semantics and features
- Add support for PEP 750: t-strings (#20085)
- Add support for PEP 800: Disjoint bases (#20084)
- Add precise inference for unpacking a TypeVar if the TypeVar has an upper bound with a precise tuple spec (#19985)
- Add precise iteration and unpacking inference for string literals and bytes literals (#20023)
- Completely ignore typeshed's stub for
Any(#20079) - Enforce that an attribute on a class
Xmust be callable in order to satisfy a member on a protocolP(#20142) - Evaluate static truthiness of non-definitely-bound symbols to "ambiguous" (#19579)
- Fix the inferred interface of specialized generic protocols (#19866)
- Infer slightly more precise types for comprehensions (#20111)
- Disable boundness analysis for implicit instance attributes (#20128)
- Add
Top[]andBottom[]special forms (#20054) - Preserve qualifiers when accessing attributes on unions/intersections (#20114)
- Strict validation of protocol members (#17750)
- Support
__init_subclass__(#20190) - Unpack variadic argument type in specialization (#20130)
- Use
invalid-assignmenterror code for invalid assignments toClassVars (#20156) - Use specialized parameter type for overload filter (#19964)
__class_getitem__is a classmethod (#20192)- Add cycle detection for find_legacy_typevars (#20124)
- Add support for cyclic legacy generic protocols (#20125)
- Don't eagerly unpack aliases in user-authored unions (#20055)
- Don't mark entire type-alias scopes as Deferred (#20086)
- Ensure union normalization really normalizes (#20147)
- Improve cycle-detection coverage for apply_type_mapping (#20159)
- Linear variance inference for PEP-695 type parameters (#18713)
- Minor
TypedDictfixes (#20146) - Typecheck dict methods for
TypedDict(#19874) - Validate constructor call of
TypedDict(#19810) - Sync vendored typeshed stubs (#20031, #20083, #20188) Typeshed diff
Diagnostics
- Add search paths info to unresolved import diagnostics (#20040)
- Better error message for attempting to assign to a read-only property (#20150)
- Improve diagnostics for bad calls to functions (#20022)
- Improve disambiguation of types via fully qualified names (#20141)
- Print diagnostics with fully qualified name to disambiguate some cases (#19850)
Performance
- Avoid unnecessary argument type expansion (#19999)
- Limit argument expansion size for overload call evaluation (#20041)
- Optimize TDD atom ordering (#20098)
Contributors
- @carljm
- @sharkdp
- @dylwil3
- @dcreager
- @MichaReiser
- @ericmarkmartin
- @Renkai
- @JelleZijlstra
- @BurntSushi
- @AlexWaygood
- @github-actions
- @PrettyWood
- @dhruvmanila
- @Glyphack
- @Gankra
- @MatthewMckee4
- @leandrobbraga
0.0.1-alpha.19
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
0.0.1-alpha.18
Bug fixes
- Fix goto definition on imports (#19834)
- Support non-generic recursive type aliases that use the
typestatement (#19805) - Handle cycles when finding implicit attributes (#19833)
Server
- Implement support for "rename" language server feature (#19551)
- Add
ty.experimental.renameserver setting (#19800) - Add
ty.inlayHints.variableTypesserver setting (#19780) - Add inlay hints for call arguments (configured by
ty.inlayHints.callArgumentNamesserver setting) (#19269) - Enable goto definition to jump to the runtime definition in the standard library for stdlib symbols (rather than the type definition in typeshed's stubs) (#19529)
- Support LSP client settings (#19614)
- Update goto range for attribute access to only target the attribute (#19848)
- Warn users if the server received unknown options (#19779)
- Render docstrings in hover (#19882)
- Resolve docstrings for modules (#19898)
Typing semantics and features
- Add precise inference for indexing, slicing and unpacking
NamedTupleinstances (#19560) - Disallow
typing.TypedDictin type expressions (#19777) - Implement module-level
__getattr__support (#19791) - Improve ability to solve TypeVars when they appear in unions (#19829)
- Improve subscript narrowing for
collections.ChainMap,collections.Counter,collections.dequeandcollections.OrderedDict(#19781) - Extend all tuple special casing to tuple subclasses (#19669)
- Use separate Rust types for bound and unbound type variables (#19796)
- Validate writes to
TypedDictkeys (#19782) typing.Selfis bound by the method, not the class (#19784)- Fix deferred name loading in PEP695 generic classes/functions (#19888)
- Improve handling of symbol-lookup edge cases involving class scopes (#19795)
Performance
- Improve performance around tuple types (#19840)
- Improve performance of subtyping and assignability checks for protocols (#19824)
- Improve multithreaded performance for large codebases (#19867)
Memory usage optimizations
Contributors
- @AlexWaygood
- @Gankra
- @ntbre
- @MichaReiser
- @PrettyWood
- @dhruvmanila
- @carljm
- @dcreager
- @UnboundVariable
- @sharkdp
- @oconnor663
- @MatthewMckee4
0.0.1-alpha.17
Bug fixes
- Always refresh diagnostics after a watched files change (#19697)
- Correctly instantiate generic class that inherits
__init__from generic base class (#19693) - Don't panic with argument that doesn't actually implement Iterable (#19602)
- Fix "peek definition" in playground (#19592)
- Fix empty spans following a line terminator and unprintable character spans in diagnostics (#19535)
- Fix incorrect diagnostic when calling
__setitem__(#19645) - Fix lookup order of class variables before they are defined (#19743)
- Fix more false positives related to
GenericorProtocolbeing subscripted with aParamSpecorTypeVarTuple(#19764) - Keep track of type qualifiers in stub declarations without right-hand side (#19756)
Server
- Add progress reporting to workspace diagnostics (#19616)
- Add stub mapping support to signature help (#19570)
- Added support for "document symbols" and "workspace symbols" (#19521)
- Fix server panic in workspace diagnostics request handler when typing (#19631)
- Implement caching for workspace and document diagnostics (#19605)
- Implement long-polling for workspace diagnostics (#19670)
- Implement streaming for workspace diagnostics (#19657)
- Implemented support for "selection range" language server feature (#19567)
CLI
- Add progress bar to
--watchmode (#19729) - Clear the terminal screen in
--watchmode (#19712) - Resolve file symlinks in src walk (#19674)
Typing semantics and features
- Support
async/await,async withandyield from(#19595) - Add support for
async forloops and async iterables (#19634) - Don't include already-bound legacy typevars in function generic context (#19558)
- Infer types for key-based access on
TypedDicts (#19763) - Improve
isinstance()truthiness analysis for generic types (#19668) - Infer
type[tuple[int, str]]as the meta-type oftuple[int, str](#19741) - Remove false positives when subscripting
GenericorProtocolwith aParamSpecorTypeVarTuple(#19749) - Remove special casing for string-literal-in-tuple
__contains__(#19642) - Remove special casing for tuple addition (#19636)
- Return
Option<TupleType>frominfer_tuple_type_expression(#19735) - Support
as-patterns in reachability analysis (#19728) - Support
__setitem__and improve__getitem__related diagnostics (#19578) - Synthesize precise
__getitem__overloads for tuple subclasses (#19493) - Track different uses of legacy typevars, including context when rendering typevars (#19604)
- Upcast heterogeneous and mixed tuples to homogeneous tuples where it's necessary to solve a
TypeVar(#19635) - Fix incorrect lazy scope narrowing (#19744)
- Synthesize
__replace__for dataclasses (#19545)
Diagnostics
- Add diagnostics for async context managers (#19704)
- Display generic function signature properly (#19544)
- Improve the
Displayfor generictype[]types (#19667) - Remap Jupyter notebook cell indices in
ruff_db(#19698)
Documentation
- Add the
tybadge (#897)
Contributors
- @mtshiba
- @MichaReiser
- @sharkdp
- @github-actions
- @UnboundVariable
- @jorenham
- @silamon
- @AlexWaygood
- @thejchap
- @ngroman
- @leandrobbraga
- @dcreager
- @ntbre
- @MatthewMckee4
0.0.1-alpha.16
Bug fixes
- Fix server panics when hovering over invalid syntax in
Callableannotations (#19517) matchstatements: Fix narrowing and reachability of class patterns with arguments (#19512)- Fix server panics when hovering over illegal
Literal[…]annotations with inner subscript expressions (#19489) - Pass down specialization to generic dataclass bases (#19472)
Server
- Add support for "go to definition" for attribute accesses and keyword arguments (#19417)
- Add support for "go to definition" for import statements (#19428)
- Add support for "document highlights" (#19515)
- Add partial support for "find references" (#19475)
- Prefer the runtime definition, not the stub definition, on a go-to-definition request for a class or function. Currently this is only implemented for definitions originating outside of the stdlib. (#19471)
- Add semantic token support for more identifiers (#19473)
- Avoid rechecking the entire project when a file in the editor is opened or closed (#19463)
Typing semantics and features
- Handle splatted arguments in function calls (#18996)
- Improve place lookup and narrowing in lazy scopes (#19321)
- Add exhaustiveness checking and reachability analysis for
matchstatements (#19508) - Improve reachability analysis for
isinstance(…)branches (#19503) - Make tuple subclass constructors sound (#19469)
- Extend tuple
__len__and__bool__special casing to also cover tuple subclasses (#19289) - Add support for
dataclasses.field(#19553) - Add support for
dataclasses.InitVar(#19527) - Add support for
@warnings.deprecatedandtyping_extensions.deprecated(#19376) - Do not consider a type
Tto satisfy a method member on a protocol unless the method is available on the meta-type ofT(#19187) - Implement expansion of enums into unions of literals (#19382)
- Support iterating over enums (#19486)
- Detect enums if metaclass is a subtype of
EnumType/EnumMeta(#19481) - Infer single-valuedness for enums deriving from
intorstr(#19510) - Detect illegal non-enum attribute accesses in
Literalannotations (#19477) - Disallow assignment to
Finalclass attributes (#19457) - Handle implicit instance attributes declared
Final(#19462) - Disallow
Finalin function parameter- and return-type annotations (#19480) - Disallow illegal uses of
ClassVar(#19483) - Make
del xforce a local resolution ofxin the current scope (#19389) - Perform type narrowing for places marked
global(#19381) - Infer correct types for attribute accesses on intersections with negative parts (#19524)
- Sync vendored typeshed stubs (typeshed diff)
Memory usage optimizations
Contributors
- @sharkdp
- @BurntSushi
- @oconnor663
- @Gankra
- @carljm
- @AlexWaygood
- @MichaReiser
- @dcreager
- @mtshiba
- @UnboundVariable
0.0.1-alpha.15
Bug fixes
- Avoid stale diagnostics for open-files diagnostic mode (#19273)
- Fix inconsistent semantic syntax highlighting for parameters (#19418)
- Fix checking of virtual files after re-opening from an unsaved edit (#19277)
- Show the correct ty version in the LSP server (#19284)
- Do not surface settings errors in unrelated Python files (#19206)
- Do not ignore conditionally defined dataclass fields (#19197)
- Fix panic for attribute expressions with empty value (#19069)
- Fix assignabiliy of dataclasses to
Callabletypes (#19192) - Fix
__setattr__call check precedence during attribute assignment (#18347)
Server
- Add definition and declaration providers (go-to-definition, go-to-declaration) (#19371)
- Add signature help provider (show signature and docstring when writing a call expression) (#19194)
- Add "kind" to completion suggestions (#19216)
- Add completions for submodules that aren't attributes of their parent (#19266)
- Filter out private type aliases from stub files when offering autocomplete suggestions (#19282)
- Handle configuration errors in the LSP more gracefully (#19262)
- Use Python version and path from VSCode Python extension (#19012)
- Publish errors in settings as LSP diagnostics (#19335)
Typing semantics and features
- Add support for
nonlocalstatements (#19112) - Support empty function bodies in
if TYPE_CHECKINGblocks (#19372) - Emit a diagnostic when attempting to modify a
typing.Final-qualified symbol (#19178) - Infer enum literal types when accessing enum members (#19328)
- Synthesize
__setattr__for frozen dataclasses (#19307) - Improve equivalence for module-literal types (#19243)
- Reduce false positives for
TypedDicttypes (#19354) - Emit an error for
globaluses if there is no explicit definition in the global scope (#19344) - Sync vendored typeshed stubs (typeshed diff)
CLI
- Add a
-q/--quietmode,-qqfor silent output mode (#19233)
Contributors
- @AlexWaygood
- @github-actions
- @dhruvmanila
- @sharkdp
- @renovate
- @MatthewMckee4
- @UnboundVariable
- @oconnor663
- @zanieb
- @MichaReiser
- @charliermarsh
- @Gankra
- @thejchap
- @BurntSushi
- @mdqst
0.0.1-alpha.14
Bug fixes
- Add cycle detection to ty's implementation of disjointness between types, fixing a possible source of stack overflows when analysing recursive types (#19139)
- Don't allow first-party code to shadow the stdlib
typesmodule (#19128). This fixes another possible source of stack overflows. - Fix descriptor lookups for most types that overlap with
None(#19120). This means that e.g.object().__str__()now correctly binds theselfargument of the__str__method, as theobjecttype overlaps withNone.
Server
- Filter a symbol from a stub file in autocomplete suggestions if it is an implementation detail of the stub (#19121)
- Add initial support for semantic tokens (#19108).
This feature allows editors to apply more advanced syntax highlighting. Currently, the supported tokens are:
Namespace,Class,Parameter,SelfParameter,ClsParameter,Variable,Property,Function,Method,Keyword,String,Number,Decorator,BuiltinConstantandTypeParameter. - Initial support for workspace diagnostics (#18939).
Enable this feature by setting the
ty.diagnosticModeconfiguration setting to"workspace". - Use Python syntax highlighting in on-hover content (#19082)
Typing semantics and features
- Understand that calls to functions returning
Never/NoReturnare terminal with respect to control flow (#18333) - Add subtyping between
type[]types andCallabletypes (#19026) - Support bare
ClassVarannotations (#15768) - Understand that two protocols with equivalent method members are equivalent (#18659)
- Support declared-only instance attributes such as
self.x: int(#19048) - Sync vendored typeshed stubs (#19174): typeshed diff
- Use the inferred type as the declared type for bare
Finalsymbols (#19142)
Contributors
- @iyakushev
- @MatthewMckee4
- @zanieb
- @sharkdp
- @UnboundVariable
- @abhijeetbodas2001
- @github-actions
- @dhruvmanila
- @AlexWaygood
- @carljm
- @CodeMan62
0.0.1-alpha.13
Bug fixes
- Fix stack overflows related to mutually recursive protocols (#19003)
- Don't add incorrect subdiagnostic for
unresolved-referenceinstaticmethods andclassmethods (#18487) - Fix rendering of long lines in diagnostic messages that are indented with tabs (#18962)
- Fix reachability of star import definitions for nonlocal lookups (#19066)
Typing semantics and features
- Support variable-length tuples in unpacking assignments (#18948)
- Allow declared-only class-level attributes to be accessed on the class (#19071)
- Infer nonlocal types as unions of all reachable bindings (#18750)
- Use all reachable bindings for instance attributes and deferred lookups (#18955)
- Improve protocol member type checking and relation handling (#18847)
- Rework disjointness of protocol instances vs types with possibly unbound attributes, preventing some false instances of
Neverinhasattrnarrowing (#19043) - Make tuple instantiations sound (#18987)
- Add subdiagnostic about empty bodies in more cases (#18942)
- Improve type-inference for
__import__(name)andimportlib.import_module(name)(#19008) - Eagerly evaluate certain constraints when analyzing control flow (#18998, #19044, #19068)
- Update typeshed stubs (#19060): typeshed diff
Server
Documentation
- The ty documentation is now available at docs.astral.sh/ty (#744)
Performance
- Remove
ScopedExpressionId(#19019)
Contributors
- @InSyncWithFoo
- @MatthewMckee4
- @dcreager
- @mtshiba
- @BurntSushi
- @sharkdp
- @ibraheemdev
- @github-actions
- @carljm
- @AlexWaygood
- @MichaReiser
- @zanieb
0.0.1-alpha.12
Bug fixes
- Avoid duplicate diagnostic when reporting errors in unpacked assignments (#18897)
- Fix panics when "pulling types" for
ClassVarorFinalparameterized with >1 argument (#18824). These could cause issues when hovering over symbols in an IDE.
Improved modeling of Python runtime semantics
- Add support for
@staticmethods (#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_ONLYfield (#18731)
Type narrowing improvements
- Ty will now perform
isinstance()andissubclass()narrowing when the second argument is a union type, intersection type orTypeVartype (#18900) - Ty now narrows types in comprehensions and generator expressions (#18934)
- Understand two
NominalInstanceTypes 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.excludepatterns, for consistency withsrc.includepatterns (#18685) - Change
environment.rootto accept multiple paths (#18913) - Rename
src.rootsetting toenvironment.root(#18760) - Support
--python=<symlink to executable>(#18827)
Contributors
- @BurntSushi
- @InSyncWithFoo
- @suneettipirneni
- @AlexWaygood
- @dhruvmanila
- @sharkdp
- @MichaReiser
- @med1844
- @dcreager
- @carljm
0.0.1-alpha.11
Breaking changes
- Stabilize auto-complete; remove the opt-in experimental setting (#18650)
Bug fixes
- Fix binary expression inference between Boolean literals and
boolinstances (#18663) - Fix panic that could occur when printing a class's "header" in diagnostic messages (#18670)
- Fix panic when attempting to provide autocompletions for an instance of a class that assigns attributes to
self[0](#18707) - Fix panics when "pulling types" for various special forms that have the wrong number of parameters. These could cause issues when hovering over symbols in an IDE. (#18642)
Typing semantics and features
- Support type narrowing for attribute and subscript expressions (#17643)
- Add partial support for
TypeIs(#18589) - Support
dataclasses.KW_ONLY(#18677) - Filter overloads based on
Any/Unknown(#18607) - Improve reachability analysis (#18621)
- Model
T: Neveras a subtype ofNever(#18687) - Update typeshed stubs (#18679): typeshed diff
Configuration
- Allow overriding rules for specific files (#18648)
Server
- Add
python.ty.disableLanguageServicesconfig (#18230)
Contributors
- @dhruvmanila
- @felixscherz
- @MichaReiser
- @alpaylan
- @mtshiba
- @github-actions
- @BurntSushi
- @InSyncWithFoo
- @AlexWaygood
- @abhijeetbodas2001
- @sharkdp
- @ibraheemdev
0.0.1-alpha.10
Server
- Improve support for
object.<CURSOR>completions (#18629)
Configuration
- Add file inclusion and exclusion (#18498)
- Infer the Python version from
--python=<system installation>on Unix (#18550)
Bug fixes
- Delay computation of 'unbound' visibility for implicit instance attributes (#18669). This fixes a significant performance regression in version 0.0.1-alpha.9.
Typing semantics and features
- Support the
delstatement; model implicit deletion of except handler names (#18593)
Release
- Include ruff/ directory in release source tarballs (#617)
Contributors
0.0.1-alpha.9
Typing semantics and features
- Add generic inference for dataclasses (#18443)
- Add support for global
__debug__constant (#18540) - Argument type expansion for overload call evaluation (#18382)
- Exclude members starting with
_abc_from a protocol interface (#18467) - Infer
list[T]for starred target in unpacking (#18401) - Infer
list[T]when unpacking non-tuple type (#18438) - Support type annotation for legacy typing aliases for generic classes (#18404)
- Allow using
dataclasses.dataclassas a function (#18440) - Type narrowing for attribute/subscript assignments (#18041)
Diagnostics
- Add hints to
invalid-type-formfor common mistakes (#18543) - Add subdiagnostic suggestion to
unresolved-referencediagnostic when variable exists onself(#18444) - Track the origin of the
environment.pythonsetting for better error messages (#18483)
CLI
- Fix
--pythonargument for Windows, and improve error messages for bad--pythonarguments (#18457)
Bug fixes
- Meta-type of type variables should be
type[..](#18439) - Only consider a type
Ta subtype of a protocolPif all ofP's members are fully bound onT(#18466) - Fix false positives for legacy
ParamSpecs insideCallabletype expressions (#18426) - Fix panic when pulling types for
UnaryOpexpressions insideLiteralslices (#18536) - Fix panic when trying to pull types for attribute expressions inside
Literaltype expressions (#18535) - Fix panic when trying to pull types for subscript expressions inside
Callabletype expressions (#18534) - Treat lambda functions as instances of
types.FunctionType(#18431) - Implement disjointness between
CallableandSpecialForm(#18503)
Server
- Fix stale diagnostics in documents on Windows (#18544)
- Add support for
object.<CURSOR>completions (#18468) - Only provide declarations and bindings as completions (#18456)
Documentation
- Add
CONDA_PREFIXto--pythondocumentation (#18574) - Update list of referenced environment variables (#612)
- Document how the default value for
python-versionis determined (#18549) - Document the
"all"option forpython-platform(#18548)
Contributors
- @AlexWaygood
- @charliermarsh
- @mtshiba
- @benbaror
- @sharkdp
- @carljm
- @MichaReiser
- @lipefree
- @BurntSushi
- @DetachHead
- @MatthewMckee4
- @suneettipirneni
- @abhijeetbodas2001
- @ibraheemdev
- @dhruvmanila
0.0.1-alpha.8
Typing semantics and features
- Add subtyping between Callable types and class literals with
__init__(#17638) - Implement implicit inheritance from
Generic[]for PEP-695 generic classes (#18283) - Infer the Python version from the environment if feasible (#18057)
- Support ephemeral uv virtual environments (#18335)
- Model that some
Callabletypes should have allFunctionTypeattributes available (#18242)
Diagnostics
- Add diagnostic hints for a function that has a non-
Nonereturn-type annotation but no return statements (#18359) - Add hint if async context manager is used in non-async with statement (#18299)
- Improve diagnostics if the user attempts to import a stdlib module that does not exist on their configured Python version (#18403)
- Tell the user why we inferred a certain Python version when reporting version-specific syntax errors (#18295)
Bug fixes
- Fix multithreading related hangs and panics (#18238)
- Ensure
Literaltypes are considered assignable to anything theirInstancesupertypes are assignable to (#18351) - Callable types are disjoint from non-callable
@finalnominal instance types (#18368) - Support callability of bound/constrained typevars (#18389)
Server
- Fix server hang after shutdown request (#18414)
- Improve completions by leveraging scopes (#18281)
- Support cancellation and retry in the server (#18273)
- Support publishing diagnostics in the server (#18309)
CLI
- Add
--config-fileCLI arg (#18083)
Contributors
- @AlexWaygood
- @BurntSushi
- @lipefree
- @MatthewMckee4
- @dhruvmanila
- @zanieb
- @carljm
- @thejchap
- @sharkdp
- @InSyncWithFoo
- @MichaReiser
0.0.1-alpha.7
Bug fixes
- Implement Python's floor-division semantics for
Literalints (#18249) - Don't warn about a
yieldexpression not being in a function if theyieldexpression is in a function (#18008) - Fix inference of attribute writes to unions/intersections that including module-literal types (#18313)
- Fix false-positive diagnostics in binary comparison inference logic for intersection types (#18266)
- Fix instance vs callable subtyping/assignability (#18260)
- Ignore
ClassVardeclarations when resolving instance members (#18241) - Fix crash when hovering over a
ty_extensions.Intersection[A, B]expression in an IDE context (#18321) - Respect
MRO_NO_OBJECT_FALLBACKpolicy when looking up symbols ontypeinstances (#18312) get_protocol_membersreturns a frozenset, not a tuple (#18284)
Typing semantics and features
- Support
import <namespace>andfrom <namespace> import module(#18137) - Support frozen dataclasses (#17974)
- Understand that the presence of a
__getattribute__method indicates arbitrary members can exist on a type (#18280) - Add a subdiagnostic if
invalid-return-typeis emitted on a method with an empty body on a non-protocol subclass of a protocol class (#18243) - Improve
invalid-type-formdiagnostic where a module-literal type is used in a type expression and the module has a member which would be valid in a type expression (#18244) - Split
invalid-baseerror code into two error codes (#18245) - Rename
call-possibly-unbound-methodtopossibly-unbound-implicit-call(#18017)
Configuration
- Add
teststosrc.rootby default if atests/directory exists and is not a package (#18286) - Tell the user why we inferred the Python version we inferred (#18082)
- Add support for detecting activated Conda and Pixi environments (#18267)
- Move
respect-ignore-filesconfiguration setting undersrcsection (#18322)
Server
- Fix server panic when calling
system_mut(#18252) - Abort process if worker thread panics (#18211)
- Gracefully handle salsa cancellations and panics in background request handlers (#18254)
Contributors
- @felixscherz
- @carljm
- @j178
- @thejchap
- @brainwane
- @AlexWaygood
- @lipefree
- @InSyncWithFoo
- @brandtbucher
- @MichaReiser
- @maxmynter
- @fabridamicelli
- @sharkdp
0.0.1-alpha.6
Server
- Add rule link to server diagnostics (#18128)
- Avoid panicking when there are multiple workspaces (#18151)
- Show related information in diagnostic (#17359)
Configuration
- Default
src.rootsetting to['.', '<project_name>']if ansrc/directory does not exist but a<project-name>/<project-name>directory does exist (#18141)
Typing semantics and features
- Consider a class with a dynamic element in its MRO assignable to any subtype of
type(#18205) - Ensure that a function-literal type is always considered equivalent to itself (#18227)
- Promote literals when inferring class specializations from constructors (#18102)
- Support
typing.TypeAliasType(#18156) - Infer function-call type variables in both directions (#18155)
Improvements to modeling of runtime semantics
- Integer indexing into
bytesreturnsint(#18218) - Emit
invalid-exception-caughtdiagnostics even when the caught exception is not bound to a variable (#18202)
Usability improvements
- Add hint to some diagnostics that PEP 604 union syntax is only available on Python 3.10+ (#18192)
- Add note to
unresolved-importdiagnostic hinting to users to configure their Python environment (#18207) - Make
division-by-zeroan opt-in diagnostic rather than opt-out (#18220)
Import resolution improvements
- Add support for PyPy virtual environments (#18203)
Contributors
- @dhruvmanila
- @InSyncWithFoo
- @AlexWaygood
- @MichaReiser
- @BradonZhang
- @dcreager
- @danielhollas
- @esadek
- @kiran-4444
- @Mathemmagician
- @sharkdp
- @felixscherz
- @adamaaronson
- @carljm
0.0.1-alpha.5
Bug fixes
- Fix assignability checks for invariant generics parameterized by gradual types (#18138)
- Revert boolean expression control flow change which caused a performance regression (#18150)
- Remove pyvenv.cfg validation check for lines with multiple
=(#18144)
Contributors
0.0.1-alpha.4
Enhancements
- Allow unions including
Any/Unknownas bases (#18094) - Better control flow for boolean expressions that are inside if (#18010)
- Improve invalid method calls for unmatched overloads (#18122)
- Add support for
NamedTuple'fallback' attributes (#18127) type[…]is always assignable totype(#18121)- Support accessing
__builtins__global (#18118)
Bug fixes
- Fix relative imports in stub packages (#18132)
Contributors
0.0.1-alpha.3
Enhancements
- Include synthesized arguments in displayed counts for
too-many-positional-arguments(#18098)
Bug fixes
- Fix
redundant-castfalse positives when casting toUnknown(#18111) - Fix normalization of unions containing instances parameterized with unions (#18112)
- Make dataclass instances adhere to DataclassInstance (#18115)
CLI
- Change layout of extra verbose output and respect
--colorfor verbose output (#18089)
Documentation
- Use Cargo-style versions in the changelog (#397)
Contributors
0.0.1-alpha.2
Enhancements
- Improve diagnostics for failure to call overloaded function (#18073)
- Fix inconsistent casing in
invalid-return-typediagnostic (#18084) - Add type-expression syntax link to
invalid-type-expressiondiagnostics (#18104)
Bug fixes
Typing
- Infer parameter specializations of explicitly implemented generic protocols (#18054)
- Check assignments to implicit global symbols are assignable to the types declared on
types.ModuleType(#18077) - Fix various generics-related TODOs (#18062)
Documentation
- Fix rule link in the configuration description (#381)
- Use
https://ty.dev/ruleswhen linking to the rules table (#18072) - Use
ty serverinstead ofty lsp(#360) - Fix missing
>in HTML anchor tags in CLI reference (#18096) - Fix link to rules docs (#378)
- Fix repository in README transform script (#361)
Contributors
- @dhruvmanila
- @Usul-Dev
- @dcreager
- @AlexWaygood
- @BurntSushi
- @MichaReiser
- @frgfm
- @kiran-4444
- @sharkdp
- @eruditmorina
0.0.1-alpha.1
Enhancements
- Add basic support for non-virtual Python environments (#17991)
- Do not allow invalid virtual environments from discovered
.venvorVIRTUAL_ENV(#18003) - Refine message for why a rule is enabled (#18038)
- Update
--pythonto accept paths to executables in environments (#17954) - Improve diagnostics for
assert_typeandassert_never(#18050) - Add a note to the diagnostic if a new builtin is used on an old Python version (#18068)
Bug fixes
- Fix infinite recursion bug in
is_disjoint_from(#18043) - Recognize submodules in self-referential imports (#18005)
Typing
- Allow a class to inherit from an intersection if the intersection contains a dynamic type and the intersection is not disjoint from
type(#18055) - Allow classes to inherit from
type[Any]ortype[Unknown](#18060) - Apply function specialization to all overloads (#18020)
- Implement
DataClassInstanceprotocol for dataclasses (#18018) - Induct into instances and subclasses when finding and applying generics (#18052)
- Infer parameter specializations of generic aliases (#18021)
- Narrowing for
hasattr()(#18053) - Silence false positives for PEP-695 ParamSpec annotations (#18001)
- Understand homogeneous tuple annotations (#17998)
__file__is always a string inside a Python module (#18071)
CLI
- Avoid initializing progress bars early (#18049)
Contributors
- @soof-golan
- @ibraheemdev
- @dhruvmanila
- @charliermarsh
- @MichaReiser
- @carljm
- @abhijeetbodas2001
- @zanieb
- @AlexWaygood
- @dcreager
- @mtshiba
- @sharkdp
0.0.0-alpha.8
Changes
- Add
--configCLI arg (#17697) - Add CLI documentation and update README (#284)
- Add a warning about pre-release status to the CLI (#17983)
- Add missing bitwise-operator branches for boolean and integer arithmetic (#17949)
- Add progress bar for
ty check(#17965) - Add CLI reference (#17978)
- Change default severity for
unbound-referencetoerror(#17936) - Change range of
revealed-typediagnostic to be the range of the argument passed in, not the whole call (#17980) - Default to latest supported Python version (#17938)
- Display "All checks passed!" message in green (#17982)
- Document configuration schema (#17950)
- Generate and add rules table (#17953)
- Handle type variables that have other type variables as a default (#17956)
- Ignore
possibly-unresolved-referenceby default (#17934) - Implement
globalhandling andload-before-global-declarationsyntax error (#17637) - Make
unused-ignore-commentdisabled by default for now (#17955) - Recognise functions containing
yield fromexpressions as being generator functions (#17930) - Fix stack overflow on recursive protocols (#17929)
- Report duplicate
ProtocolorGenericbase classes with[duplicate-base], not[inconsistent-mro](#17971) - Respect the gradual guarantee when reporting errors in resolving MROs (#17962)
- Support
typing.Selfin methods (#17689) - Support extending
__all__from an imported module even when the module is not anExprNamenode (#17947) - Support extending
__all__with a literal tuple or set as well as a literal list (#17948) - Understand classes that inherit from subscripted
Protocol[]as generic (#17832) - Update ty metadata (#17943)
- Add
py.typed(#276) - Bottom-up improvement of diagnostic messages for union type function calls (#17984)
- Fix more ecosystem/fuzzer panics with fixpoint (#17758)
- Remove
lint:prefix from top-level diagnostic preamble (#17987)