Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
241 initial ty diagnostics are suppressed via config to help gradually migrate. Someone can pick this up and run with it to see how it goes.
ty Diagnostics Report
(i didnt make this)Total: 240 diagnostics (without suppressions)
Summary by Rule
invalid-keyinvalid-type-forminvalid-argument-typeno-matching-overloadinvalid-assignmentcall-non-callableinvalid-return-typepossibly-missing-attributeunresolved-importunresolved-attributedeprecatedunsupported-baseredundant-castnot-iterablemissing-typed-dict-keyDetails by Category
invalid-key(52 errors)TypedDict key errors - mostly ASGI scope/event types with keys ty doesn't recognize.
Common patterns:
WebSocketSendEventHTTPResponseStartEventWebSocketScopeRoot cause: ty's typeshed stubs for ASGI types may be incomplete or differ from runtime behavior.
invalid-type-form(51 errors)Invalid type annotations that ty doesn't understand.
Common patterns:
Literal[struct_info.tag]- dynamic Literal valueslistmethod return typeRoot cause: Some advanced typing patterns not yet supported by ty.
invalid-argument-type(50 errors)Function argument type mismatches.
Common patterns:
objectpassed where specific type expected (after isinstance narrowing)Root cause: ty's type narrowing may be less sophisticated than mypy/pyright.
no-matching-overload(29 errors)No overload signature matches the call.
Common patterns:
ResponseHeader(name=..., value=...)Root cause: Overload resolution differences from mypy/pyright.
invalid-assignment(11 errors)Type mismatch in variable assignments.
Common patterns:
call-non-callable(10 errors)Calling objects ty thinks aren't callable.
Common patterns:
HTTPRouteHandler,WebsocketRouteHandler)RouterclassRoot cause: ty may not recognize callable protocols or
__call__methods.invalid-return-type(9 errors)Return type doesn't match declared type.
Common patterns:
Nonereturnsunresolved-import(6 errors)Cannot resolve imported module.
Affected modules:
litestar.plugins.sqlalchemy(external package)picologging(optional dependency)exceptiongroup(Python 3.11+ backport)unresolved-attribute(6 errors)Attribute access on objects ty can't resolve.
Common patterns:
BaseException.extra,BaseException.detailBuildEnvironmentcustom attributesdeprecated(3 warnings)Usage of deprecated APIs.
Affected:
datetime.utcnow()parse_obj_as,from_orm)Recommended Fix Priority
deprecated(3) - easy fixes, good practiceinvalid-return-type(9) - add explicit returnsinvalid-key(52) - may be ty bug with ASGI typesinvalid-type-form(51) - may need typing workaroundscall-non-callable,no-matching-overload- likely ty limitationsConfiguration
Current suppressions in
pyproject.toml:Closes
Closes #4491