Skip to content

Conversation

@dcreager
Copy link
Member

This stacks on top of #19997, and uses the new constraint set implementation to check assignability for typevars.

Not ready for review yet.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2025

Diagnostic diff on typing conformance tests

Changes were detected when running ty on typing conformance tests
--- old-output.txt	2025-11-25 02:48:19.657726287 +0000
+++ new-output.txt	2025-11-25 02:48:23.676736894 +0000
@@ -1,4 +1,4 @@
-fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/17bc55d/src/function/execute.rs:469:17 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(1a6a3)): execute: too many cycle iterations`
+fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/17bc55d/src/function/execute.rs:469:17 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(1c6a3)): execute: too many cycle iterations`
 _directives_deprecated_library.py:15:31: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `int`
 _directives_deprecated_library.py:30:26: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `str`
 _directives_deprecated_library.py:36:41: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `Self@__add__`
@@ -545,7 +545,6 @@
 generics_syntax_infer_variance.py:56:35: error[invalid-assignment] Object of type `ShouldBeCovariant3[int | float]` is not assignable to `ShouldBeCovariant3[int]`
 generics_syntax_infer_variance.py:84:36: error[invalid-assignment] Object of type `ShouldBeCovariant5[int]` is not assignable to `ShouldBeCovariant5[int | float]`
 generics_syntax_infer_variance.py:85:34: error[invalid-assignment] Object of type `ShouldBeCovariant5[int | float]` is not assignable to `ShouldBeCovariant5[int]`
-generics_syntax_infer_variance.py:92:9: error[invalid-assignment] Cannot assign to final attribute `x` on type `Self@__init__`
 generics_syntax_infer_variance.py:95:36: error[invalid-assignment] Object of type `ShouldBeCovariant6[int]` is not assignable to `ShouldBeCovariant6[int | float]`
 generics_syntax_infer_variance.py:96:34: error[invalid-assignment] Object of type `ShouldBeCovariant6[int | float]` is not assignable to `ShouldBeCovariant6[int]`
 generics_syntax_infer_variance.py:112:38: error[invalid-assignment] Object of type `ShouldBeInvariant1[int]` is not assignable to `ShouldBeInvariant1[int | float]`
@@ -815,6 +814,7 @@
 protocols_generic.py:66:25: error[invalid-assignment] Object of type `Sender[int]` is not assignable to `Sender[int | float]`
 protocols_generic.py:74:28: error[invalid-assignment] Object of type `AttrProto[int]` is not assignable to `AttrProto[int | float]`
 protocols_generic.py:75:26: error[invalid-assignment] Object of type `AttrProto[int | float]` is not assignable to `AttrProto[int]`
+protocols_generic.py:147:25: error[invalid-assignment] Object of type `ConcreteHasProperty4` is not assignable to `HasPropertyProto`
 protocols_merging.py:52:25: error[invalid-assignment] Object of type `SCConcrete2` is not assignable to `SizedAndClosable1`
 protocols_merging.py:53:25: error[invalid-assignment] Object of type `SCConcrete2` is not assignable to `SizedAndClosable2`
 protocols_merging.py:54:25: error[invalid-assignment] Object of type `SCConcrete2` is not assignable to `SizedAndClosable3`

@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2025

mypy_primer results

Changes were detected when running on open source projects
pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+ pytest_robotframework/__init__.py:326:9: error[invalid-overload] Overloaded function `__call__` requires at least two overloads
+ pytest_robotframework/__init__.py:472:5: error[invalid-overload] Overloaded function `keyword` requires at least two overloads
+ pytest_robotframework/__init__.py:525:12: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ pytest_robotframework/__init__.py:526:9: error[unknown-argument] Argument `name` does not match any known parameter of function `keyword`
+ pytest_robotframework/__init__.py:527:9: error[unknown-argument] Argument `tags` does not match any known parameter of function `keyword`
+ pytest_robotframework/__init__.py:528:9: error[unknown-argument] Argument `module` does not match any known parameter of function `keyword`
+ pytest_robotframework/__init__.py:529:9: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ pytest_robotframework/__init__.py:530:9: error[unknown-argument] Argument `max_argument_length_in_log` does not match any known parameter of function `keyword`
+ pytest_robotframework/__init__.py:599:9: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ pytest_robotframework/__init__.py:599:9: error[no-matching-overload] No overload of function `keyword` matches arguments
+ pytest_robotframework/__init__.py:599:17: error[unknown-argument] Argument `name` does not match any known parameter of function `keyword`
+ pytest_robotframework/__init__.py:599:28: error[unknown-argument] Argument `tags` does not match any known parameter of function `keyword`
+ pytest_robotframework/__init__.py:599:39: error[unknown-argument] Argument `module` does not match any known parameter of function `keyword`
+ pytest_robotframework/__init__.py:599:54: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_args.py:6:2: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_args.py:6:10: error[unknown-argument] Argument `max_argument_length_in_log` does not match any known parameter of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_context_manager_that_doesnt_suppress.py:14:2: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_context_manager_that_doesnt_suppress.py:14:10: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_context_manager_that_raises_in_body_and_exit.py:14:2: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_context_manager_that_raises_in_body_and_exit.py:14:10: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_context_manager_that_raises_in_exit.py:14:2: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_context_manager_that_raises_in_exit.py:14:10: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_custom_name_and_tags.py:6:2: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_custom_name_and_tags.py:6:10: error[unknown-argument] Argument `name` does not match any known parameter of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_custom_name_and_tags.py:6:26: error[unknown-argument] Argument `tags` does not match any known parameter of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_returns_context_manager_that_isnt_used.py:14:2: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/fixtures/test_python/test_keyword_decorator_returns_context_manager_that_isnt_used.py:14:10: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ tests/type_tests.py:18:6: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/type_tests.py:18:14: error[unknown-argument] Argument `name` does not match any known parameter of function `keyword`
+ tests/type_tests.py:18:30: error[unknown-argument] Argument `tags` does not match any known parameter of function `keyword`
+ tests/type_tests.py:39:6: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/type_tests.py:39:14: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ tests/type_tests.py:47:6: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/type_tests.py:47:14: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ tests/type_tests.py:64:6: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/type_tests.py:64:14: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
+ tests/type_tests.py:69:6: error[missing-argument] No argument provided for required parameter `fn` of function `keyword`
+ tests/type_tests.py:69:14: error[unknown-argument] Argument `wrap_context_manager` does not match any known parameter of function `keyword`
- Found 175 diagnostics
+ Found 213 diagnostics

parso (https://github.com/davidhalter/parso)
- parso/python/tokenize.py:230:42: error[invalid-argument-type] Argument is incorrect: Expected `tuple[str]`, found `set[str]`
+ parso/python/tokenize.py:230:42: error[invalid-argument-type] Argument is incorrect: Expected `tuple[str]`, found `set[Unknown]`

anyio (https://github.com/agronholm/anyio)
- src/anyio/__init__.py:46:29: warning[deprecated] The function `wait_socket_readable` is deprecated: This function is deprecated; use `wait_readable` instead
- src/anyio/__init__.py:47:29: warning[deprecated] The function `wait_socket_writable` is deprecated: This function is deprecated; use `wait_writable` instead
- Found 222 diagnostics
+ Found 220 diagnostics

DateType (https://github.com/glyph/DateType)
- src/datetype/__init__.py:529:32: warning[deprecated] The function `utcfromtimestamp` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.timezone.utc)
- src/datetype/__init__.py:533:32: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 8 diagnostics
+ Found 6 diagnostics

python-sop (https://gitlab.com/dkg/python-sop)
- sop/__init__.py:424:29: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 3 diagnostics
+ Found 2 diagnostics

attrs (https://github.com/python-attrs/attrs)
- src/attr/_make.py:469:35: warning[possibly-unbound-attribute] Attribute `init` on type `Attribute | Unknown` is possibly unbound
- src/attr/_make.py:469:59: warning[possibly-unbound-attribute] Attribute `kw_only` on type `Attribute | Unknown` is possibly unbound
- src/attr/_make.py:481:16: warning[possibly-unbound-attribute] Attribute `alias` on type `Attribute | Unknown` is possibly unbound
- src/attr/_make.py:483:70: warning[possibly-unbound-attribute] Attribute `name` on type `Attribute | Unknown` is possibly unbound
- src/attr/_make.py:487:19: warning[possibly-unbound-attribute] Attribute `name` on type `Attribute | Unknown` is possibly unbound
- tests/test_make.py:146:14: error[unresolved-attribute] Type `Literal[42]` has no attribute `default`
- tests/test_make.py:866:21: error[no-matching-overload] No overload of function `attrib` matches arguments
- Found 563 diagnostics
+ Found 556 diagnostics

pyinstrument (https://github.com/joerick/pyinstrument)
- pyinstrument/stack_sampler.py:49:1: error[invalid-assignment] Object of type `ContextVar[None]` is not assignable to `ContextVar[object]`
- pyinstrument/vendor/decorator.py:57:42: warning[deprecated] The function `getargspec` is deprecated: Deprecated since Python 3.0; removed in Python 3.11. Use `inspect.signature()` instead.
- Found 42 diagnostics
+ Found 40 diagnostics

antidote (https://github.com/Finistere/antidote)
- src/antidote/core/_scope.py:51:16: error[invalid-return-type] Return type does not match returned value: expected `ScopeVarToken[T@AbstractScopeVar, Any]`, found `ScopeVarToken[T@AbstractScopeVar | Missing, Unknown]`
+ tests/core/test_inject.py:365:49: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- tests/core/test_thread_safety.py:277:61: error[invalid-argument-type] Argument to bound method `set_value` is incorrect: Expected `() -> Literal["a"]`, found `def callback() -> str`
+ tests/core/test_utils.py:59:37: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ tests/lib/injectable/test_injectable.py:173:31: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ tests/lib/injectable/test_injectable.py:220:39: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 382 diagnostics
+ Found 384 diagnostics

speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
- backend/api/api_wrappers.py:56:33: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- backend/api/core_api.py:36:29: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- backend/api/core_api.py:37:29: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- backend/api/global_scoreboard_api.py:76:20: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- backend/services/user_updater.py:78:30: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 65 diagnostics
+ Found 60 diagnostics

werkzeug (https://github.com/pallets/werkzeug)
- src/werkzeug/datastructures/mixins.py:262:28: error[invalid-argument-type] Argument is incorrect: Expected `typing.Self`, found `Self@setdefault`
- src/werkzeug/datastructures/mixins.py:282:28: error[invalid-argument-type] Argument is incorrect: Expected `typing.Self`, found `Self@pop`
- src/werkzeug/datastructures/structures.py:1104:28: error[invalid-argument-type] Argument is incorrect: Expected `Self@__init__`, found `Self@remove`
- src/werkzeug/datastructures/structures.py:1119:28: error[invalid-argument-type] Argument is incorrect: Expected `Self@__init__`, found `Self@update`
- src/werkzeug/datastructures/structures.py:1159:28: error[invalid-argument-type] Argument is incorrect: Expected `Self@__init__`, found `Self@clear`
- src/werkzeug/datastructures/structures.py:1185:28: error[invalid-argument-type] Argument is incorrect: Expected `Self@__init__`, found `Self@__delitem__`
- src/werkzeug/datastructures/structures.py:1193:28: error[invalid-argument-type] Argument is incorrect: Expected `Self@__init__`, found `Self@__setitem__`
+ src/werkzeug/local.py:499:45: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 369 diagnostics
+ Found 363 diagnostics

Expression (https://github.com/cognitedata/Expression)
- expression/collections/seq.py:637:41: error[invalid-argument-type] Argument to function `init_infinite` is incorrect: Expected `(int, /) -> Unknown`, found `def identity[_A](value: _A@identity) -> _A@identity`
- expression/core/option.py:221:16: error[invalid-return-type] Return type does not match returned value: expected `Option[_TSource@of_optional]`, found `Option[_TSource@of_optional | None]`
- expression/extra/option/pipeline.py:91:19: error[invalid-argument-type] Argument to function `reduce` is incorrect: Expected `(def Some[_T1](value: _T1@Some) -> Option[_T1@Some], (Any, /) -> Option[Any], /) -> def Some[_T1](value: _T1@Some) -> Option[_T1@Some]`, found `def reducer(acc: (Any, /) -> Option[Any], fn: (Any, /) -> Option[Any]) -> (Any, /) -> Option[Any]`
- expression/extra/result/pipeline.py:96:19: error[invalid-argument-type] Argument to function `reduce` is incorrect: Expected `(def Ok[_TSource](value: _TSource@Ok) -> Result[_TSource@Ok, Any], (Any, /) -> Result[Any, Any], /) -> def Ok[_TSource](value: _TSource@Ok) -> Result[_TSource@Ok, Any]`, found `def reducer(acc: (Any, /) -> Result[Any, Any], fn: (Any, /) -> Result[Any, Any]) -> (Any, /) -> Result[Any, Any]`
- expression/extra/result/traversable.py:50:21: error[invalid-argument-type] Argument to function `traverse` is incorrect: Expected `(Result[_TSource@sequence, _TError@sequence], /) -> Result[Unknown, Unknown]`, found `def identity[_A](value: _A@identity) -> _A@identity`
+ expression/extra/result/traversable.py:50:21: error[invalid-argument-type] Argument to function `traverse` is incorrect: Expected `(Unknown, /) -> Result[Unknown, Unknown]`, found `def identity[_A](value: _A@identity) -> _A@identity`
- tests/test_array.py:137:5: error[invalid-assignment] Object of type `TypedArray[Literal[42]]` is not assignable to `TypedArray[int]`
- tests/test_array.py:307:38: error[invalid-argument-type] Argument to function `reduce` is incorrect: Expected `(Literal[0], int, /) -> Literal[0]`, found `def folder(x: int, y: int) -> int`
- tests/test_array.py:322:49: error[invalid-argument-type] Argument to function `unfold` is incorrect: Expected `(Literal[0], /) -> Option[tuple[Unknown, Literal[0]]]`, found `def unfolder(state: int) -> Option[tuple[int, int]]`
- tests/test_block.py:274:38: error[invalid-argument-type] Argument to function `reduce` is incorrect: Expected `(Literal[0], int, /) -> Literal[0]`, found `def folder(x: int, y: int) -> int`
- tests/test_block.py:289:39: error[invalid-argument-type] Argument to function `unfold` is incorrect: Expected `(Literal[0], /) -> Option[tuple[Unknown, Literal[0]]]`, found `def unfolder(state: int) -> Option[tuple[int, int]]`
- tests/test_map.py:49:19: error[invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Map[str, int], /) -> Unknown`, found `def to_seq[_Key, _Value](table: Map[_Key@to_seq, _Value@to_seq]) -> Iterable[tuple[_Key@to_seq, _Value@to_seq]]`
- tests/test_option.py:120:12: error[unsupported-operator] Operator `>` is not supported for types `Option[Literal[42]]` and `Option[Literal[41]]`
- tests/test_option.py:121:12: error[unsupported-operator] Operator `<` is not supported for types `Option[Literal[41]]` and `Option[Literal[42]]`
- tests/test_parser.py:232:9: error[invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Parser[str], /) -> Unknown`, found `def many[_A](parser: Parser[_A@many]) -> Parser[Block[_A@many]]`
- tests/test_result.py:487:24: error[invalid-argument-type] Argument to bound method `pipe` is incorrect: Expected `(Result[Literal[42], Any], /) -> Unknown`, found `def swap[_TSource, _TError](result: Result[_TSource@swap, _TError@swap]) -> Result[_TError@swap, _TSource@swap]`
- tests/test_result.py:491:21: error[invalid-argument-type] Argument to bound method `or_else` is incorrect: Expected `Result[Literal[42], Any]`, found `Result[Literal[0], Any]`
- tests/test_result.py:509:21: error[invalid-argument-type] Argument to bound method `or_else` is incorrect: Expected `Result[Any, Literal["original error"]]`, found `Result[Any, Literal["new error"]]`
- tests/test_result.py:573:24: error[invalid-argument-type] Argument to bound method `pipe` is incorrect: Expected `(Result[Literal[42], Any], /) -> Unknown`, found `def merge[_TSource](result: Result[_TSource@merge, _TSource@merge]) -> _TSource@merge`
- tests/test_seq.py:308:20: error[invalid-argument-type] Argument to bound method `choose` is incorrect: Expected `(None | Literal[42], /) -> Option[Unknown]`, found `def of_optional[_TSource](value: _TSource@of_optional | None) -> Option[_TSource@of_optional]`
- tests/test_try.py:13:5: error[invalid-assignment] Object of type `Try[Literal[10]]` is not assignable to `Try[int]`
- tests/test_try.py:34:5: error[invalid-assignment] Object of type `Try[Literal[10]]` is not assignable to `Try[int]`
- Found 225 diagnostics
+ Found 205 diagnostics

dedupe (https://github.com/dedupeio/dedupe)
- dedupe/predicates.py:116:20: error[invalid-return-type] Return type does not match returned value: expected `frozenset[Literal["0", "1"]]`, found `frozenset[str]`
- dedupe/predicates.py:118:20: error[invalid-return-type] Return type does not match returned value: expected `frozenset[Literal["0", "1"]]`, found `frozenset[str]`
- Found 56 diagnostics
+ Found 54 diagnostics

alerta (https://github.com/alerta/alerta)
- alerta/auth/oidc.py:99:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/auth/utils.py:52:20: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/commands.py:66:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:190:56: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:214:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1116:79: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1194:51: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1259:52: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1301:67: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1517:41: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1603:44: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1608:41: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1618:100: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1668:95: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/base.py:1718:95: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/utils.py:250:79: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/utils.py:250:120: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/utils.py:252:68: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/utils.py:254:67: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/utils.py:345:70: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/database/backends/mongodb/utils.py:347:69: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/dev.py:4:23: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/management/views.py:144:39: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:66:72: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:75:74: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:282:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:335:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:379:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:430:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:574:34: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:594:34: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:609:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/alert.py:637:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/blackout.py:37:65: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/blackout.py:60:91: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/blackout.py:84:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/heartbeat.py:56:52: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/heartbeat.py:59:74: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/heartbeat.py:61:31: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/history.py:16:72: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/key.py:31:52: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/key.py:42:49: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/key.py:164:57: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/note.py:25:91: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/user.py:41:72: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/models/user.py:44:72: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/utils/audit.py:94:36: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/utils/client.py:44:45: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- alerta/views/alerts.py:309:27: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- tests/test_blackouts.py:688:42: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 497 diagnostics
+ Found 447 diagnostics

koda-validate (https://github.com/keithasaurus/koda-validate)
- koda_validate/generic.py:321:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@Strip`, found `str | bytes`
+ koda_validate/generic.py:321:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@Strip`, found `Unknown | bytes`
- koda_validate/generic.py:330:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@UpperCase`, found `str | bytes`
+ koda_validate/generic.py:330:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@UpperCase`, found `Unknown | bytes`
- koda_validate/generic.py:336:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@LowerCase`, found `str | bytes`
+ koda_validate/generic.py:336:16: error[invalid-return-type] Return type does not match returned value: expected `StrOrBytes@LowerCase`, found `Unknown | bytes`

dulwich (https://github.com/dulwich/dulwich)
- dulwich/pack.py:728:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[tuple[bytes, int, int | None]]`, found `list[tuple[bytes, int, int]]`
- dulwich/porcelain.py:6550:25: warning[deprecated] The function `warn` is deprecated: Deprecated since Python 3.3. Use `warning()` instead.
- Found 195 diagnostics
+ Found 193 diagnostics

artigraph (https://github.com/artigraph/artigraph)
- src/arti/internal/type_hints.py:177:37: error[invalid-argument-type] Argument to function `_check_issubclass` is incorrect: Expected `type`, found `T@lenient_issubclass & ~tuple[Unknown, ...]`
- Found 133 diagnostics
+ Found 132 diagnostics

zope.interface (https://github.com/zopefoundation/zope.interface)
- src/zope/interface/exceptions.py:202:27: warning[deprecated] The function `getargspec` is deprecated: Deprecated since Python 3.0; removed in Python 3.11. Use `inspect.signature()` instead.
- src/zope/interface/exceptions.py:203:33: warning[deprecated] The function `formatargspec` is deprecated: Deprecated since Python 3.5; removed in Python 3.11. Use `inspect.signature()` and the `Signature` class instead.
- src/zope/interface/exceptions.py:219:23: error[no-matching-overload] No overload of class `str` matches arguments
- src/zope/interface/exceptions.py:219:33: error[invalid-argument-type] Argument to function `formatargspec` is incorrect: Expected `list[str]`, found `Signature | ArgSpec`
- Found 340 diagnostics
+ Found 336 diagnostics

psycopg (https://github.com/psycopg/psycopg)
- tests/types/test_array.py:314:12: error[non-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- Found 642 diagnostics
+ Found 641 diagnostics

httpx-caching (https://github.com/johtso/httpx-caching)
- httpx_caching/_heuristics.py:14:29: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 29 diagnostics
+ Found 28 diagnostics

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- bson/regex.py:83:16: error[invalid-return-type] Return type does not match returned value: expected `Regex[_T@Regex]`, found `Regex[str]`
- pymongo/_csot.py:30:1: error[invalid-assignment] Object of type `ContextVar[None]` is not assignable to `ContextVar[int | float | None]`
- pymongo/_csot.py:31:1: error[invalid-assignment] Object of type `ContextVar[float]` is not assignable to `ContextVar[int | float]`
- pymongo/_csot.py:32:1: error[invalid-assignment] Object of type `ContextVar[float]` is not assignable to `ContextVar[int | float]`
+ pymongo/pool_shared.py:297:86: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ pymongo/pool_shared.py:418:72: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- pymongo/ssl_support.py:124:13: error[invalid-assignment] Object of type `Any | Literal[0]` is not assignable to attribute `verify_flags` on type `SSLContext | SSLContext`
+ pymongo/ssl_support.py:124:13: error[invalid-assignment] Object of type `Any` is not assignable to attribute `verify_flags` on type `SSLContext | SSLContext`
- Found 507 diagnostics
+ Found 505 diagnostics

strawberry (https://github.com/strawberry-graphql/strawberry)
+ strawberry/printer/printer.py:203:75: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- strawberry/types/object_type.py:157:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `type[type]`, found `T@_process_type`

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ tests/annotations/declarations.py:1173:16: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ tests/annotations/declarations.py:1208:5: error[type-assertion-failure] Argument does not have asserted type `dict[str, int]`
+ tests/annotations/mypy_checks.py:76:5: error[type-assertion-failure] Argument does not have asserted type `bool`
+ tests/annotations/mypy_checks.py:77:5: error[type-assertion-failure] Argument does not have asserted type `bool`
+ tests/annotations/mypy_checks.py:86:16: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 567 diagnostics
+ Found 572 diagnostics

trio (https://github.com/python-trio/trio)
- src/trio/_core/_io_common.py:28:54: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `BaseException`
+ src/trio/_core/_run.py:2906:55: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- src/trio/_core/_tests/test_run.py:240:26: error[invalid-argument-type] Argument to function `reschedule` is incorrect: Expected `Task`, found `Task | None`
- src/trio/_core/_tests/test_run.py:247:26: error[invalid-argument-type] Argument to function `reschedule` is incorrect: Expected `Task`, found `Task | None`
- src/trio/_core/_tests/test_run.py:285:16: warning[possibly-unbound-attribute] Attribute `parent_task` on type `Nursery | None` is possibly unbound
- src/trio/_core/_tests/test_run.py:293:12: warning[possibly-unbound-attribute] Attribute `parent_nursery` on type `Task | None` is possibly unbound
- src/trio/_core/_tests/test_run.py:293:35: warning[possibly-unbound-attribute] Attribute `eventual_parent_nursery` on type `Task | None` is possibly unbound
- src/trio/_core/_tests/test_run.py:1419:13: warning[possibly-unbound-attribute] Attribute `run_sync_soon` on type `TrioToken | None` is possibly unbound
- src/trio/_core/_tests/test_run.py:1621:16: warning[possibly-unbound-attribute] Attribute `parent_task` on type `Nursery | None` is possibly unbound
- src/trio/_core/_tests/test_run.py:2244:61: error[invalid-argument-type] Argument to bound method `set` is incorrect: Expected `None`, found `Literal["nullio"]`
- src/trio/_core/_tests/test_run.py:2357:17: error[invalid-argument-type] Argument to function `reattach_detached_coroutine_object` is incorrect: Expected `Task`, found `Task | None`
- src/trio/_path.py:235:34: error[invalid-argument-type] Argument to function `_wrap_method_path` is incorrect: Expected `(...) -> Path`, found `def readlink(self) -> Self@readlink`
- src/trio/_path.py:236:32: error[invalid-argument-type] Argument to function `_wrap_method_path` is incorrect: Expected `(...) -> Path`, found `def rename(self, target: str | PurePath) -> Self@rename`
- src/trio/_path.py:237:33: error[invalid-argument-type] Argument to function `_wrap_method_path` is incorrect: Expected `(...) -> Path`, found `def replace(self, target: str | PurePath) -> Self@replace`
- src/trio/_path.py:238:33: error[invalid-argument-type] Argument to function `_wrap_method_path` is incorrect: Expected `(...) -> Path`, found `def resolve(self, strict: bool = Literal[False]) -> Self@resolve`
- src/trio/_path.py:245:34: error[invalid-argument-type] Argument to function `_wrap_method_path` is incorrect: Expected `(...) -> Path`, found `def absolute(self) -> Self@absolute`
- src/trio/_path.py:246:36: error[invalid-argument-type] Argument to function `_wrap_method_path` is incorrect: Expected `(...) -> Path`, found `def expanduser(self) -> Self@expanduser`
- src/trio/_subprocess.py:783:16: error[invalid-return-type] Return type does not match returned value: expected `CompletedProcess[bytes]`, found `CompletedProcess[bytes | None]`
- src/trio/_tests/test_highlevel_open_unix_stream.py:49:21: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- src/trio/_tests/test_highlevel_open_unix_stream.py:57:25: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- src/trio/_tests/test_sync.py:30:11: warning[deprecated] The function `__bool__` is deprecated: trio.Event.__bool__ is deprecated since Trio 0.31.0; use trio.Event.is_set instead (https://github.com/python-trio/trio/issues/3238)
- src/trio/_tests/test_threads.py:89:44: error[invalid-argument-type] Argument to function `check_case` is incorrect: Expected `(...) -> Literal[2] | Awaitable[Literal[2]]`, found `def f1(record: Unknown | list[tuple[str, Thread | type[BaseException]]]) -> int`
- src/trio/_tests/test_util.py:116:22: warning[deprecated] The function `coroutine` is deprecated: Deprecated since Python 3.8; removed in Python 3.11. Use `async def` instead.
+ src/trio/_tests/test_util.py:123:61: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 681 diagnostics
+ Found 661 diagnostics

stone (https://github.com/dropbox/stone)
+ stone/frontend/ir_generator.py:9:49: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- test/test_python_gen.py:145:33: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- test/test_python_gen.py:221:33: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- test/test_python_gen.py:413:33: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 86 diagnostics
+ Found 84 diagnostics

discord.py (https://github.com/Rapptz/discord.py)
+ discord/ext/commands/bot.py:1188:56: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ discord/ext/commands/converter.py:326:28: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- discord/member.py:931:91: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- discord/member.py:987:61: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
+ discord/utils.py:815:84: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 531 diagnostics
+ Found 532 diagnostics

pydantic (https://github.com/pydantic/pydantic)
- pydantic/__init__.py:66:46: warning[deprecated] The function `root_validator` is deprecated: Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details
- pydantic/__init__.py:66:62: warning[deprecated] The function `validator` is deprecated: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details
- pydantic/_internal/_config.py:143:28: error[invalid-key] Cannot access `ConfigDict` with a key of type `str`. Only string literals are allowed as keys on TypedDicts.
- pydantic/_internal/_generics.py:96:1: error[invalid-assignment] Object of type `ContextVar[None]` is not assignable to `ContextVar[WeakValueDictionary[tuple[Any, Any, tuple[Any, ...]], type[BaseModel]] | None]`
- pydantic/_internal/_generics.py:395:1: error[invalid-assignment] Object of type `ContextVar[None]` is not assignable to `ContextVar[set[str] | None]`
- pydantic/_internal/_validators.py:162:16: error[invalid-return-type] Return type does not match returned value: expected `Pattern[bytes]`, found `Pattern[str]`
- pydantic/_internal/_validators.py:174:16: error[no-matching-overload] No overload of function `compile` matches arguments
- pydantic/deprecated/decorator.py:85:72: warning[deprecated] The function `validate_arguments` is deprecated: The `validate_arguments` method is deprecated; use `validate_call` instead.
- pydantic/deprecated/json.py:132:16: warning[deprecated] The function `pydantic_encoder` is deprecated: `pydantic_encoder` is deprecated, use `pydantic_core.to_jsonable_python` instead.
- pydantic/deprecated/parse.py:78:12: warning[deprecated] The function `load_str_bytes` is deprecated: `load_str_bytes` is deprecated.
- pydantic/deprecated/tools.py:101:9: warning[deprecated] The function `schema_of` is deprecated: `schema_of` is deprecated. Use `pydantic.TypeAdapter.json_schema` instead.
+ pydantic/json_schema.py:2592:9: error[invalid-overload] Overloaded function `__init__` requires at least two overloads
- pydantic/main.py:264:30: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:275:39: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:285:30: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:433:10: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:543:10: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:934:34: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:1088:31: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:1099:35: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:1242:29: warning[deprecated] The function `dict` is deprecated: The `dict` method is deprecated; use `model_dump` instead.
- pydantic/main.py:1356:25: warning[deprecated] The function `load_str_bytes` is deprecated: `load_str_bytes` is deprecated.
- pydantic/main.py:1409:21: warning[deprecated] The function `load_file` is deprecated: `load_file` is deprecated.
- pydantic/main.py:1551:38: warning[deprecated] The function `pydantic_encoder` is deprecated: `pydantic_encoder` is deprecated, use `pydantic_core.to_jsonable_python` instead.
- pydantic/main.py:1555:21: warning[deprecated] The function `pydantic_encoder` is deprecated: `pydantic_encoder` is deprecated, use `pydantic_core.to_jsonable_python` instead.
- Found 768 diagnostics
+ Found 745 diagnostics

optuna (https://github.com/optuna/optuna)
- optuna/storages/_rdb/storage.py:460:17: error[invalid-assignment] Object of type `Unknown | Column[Unknown]` is not assignable to attribute `number` on type `FrozenTrial & ~AlwaysFalsy`
- optuna/storages/_rdb/storage.py:461:17: error[invalid-assignment] Object of type `Unknown | Column[Unknown]` is not assignable to attribute `datetime_start` on type `FrozenTrial & ~AlwaysFalsy`
- optuna/visualization/_parallel_coordinate.py:195:13: error[invalid-assignment] Object of type `list[int]` is not assignable to `list[int | float]`
- optuna/visualization/_parallel_coordinate.py:229:17: error[invalid-argument-type] Argument is incorrect: Expected `list[int | float]`, found `list[int]`
- tests/gp_tests/test_acqf.py:71:23: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `GPRegressor | SearchSpace`, found `float`
- tests/samplers_tests/test_samplers.py:371:5: error[invalid-assignment] Object of type `dict[str, CategoricalDistribution]` is not assignable to `dict[str, BaseDistribution]`
- Found 561 diagnostics
+ Found 555 diagnostics

aiohttp-devtools (https://github.com/aio-libs/aiohttp-devtools)
- tests/test_runserver_watch.py:108:5: error[invalid-assignment] Object of type `set[tuple[MagicMock, str]]` is not assignable to `set[tuple[WebSocketResponse, str]]`
- Found 124 diagnostics
+ Found 123 diagnostics

mkosi (https://github.com/systemd/mkosi)
- mkosi/documentation.py:32:29: warning[deprecated] The function `warn` is deprecated: Deprecated since Python 3.3. Use `warning()` instead.
- Found 101 diagnostics
+ Found 100 diagnostics

SinbadCogs (https://github.com/mikeshardmind/SinbadCogs)
- antimentionspam/antimentionspam.py:239:26: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- embedmaker/serialize.py:81:34: warning[deprecated] The function `utcfromtimestamp` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.timezone.utc)
- embedmaker/time_utils.py:42:54: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- modnotes/modnotes.py:148:32: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- rolemanagement/events.py:41:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- scheduler/message.py:82:57: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- scheduler/time_utils.py:42:54: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 144 diagnostics
+ Found 137 diagnostics

schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/specs/openapi/negative/mutations.py:445:33: error[invalid-parameter-default] Default value of type `def ident[T](x: T@ident) -> T@ident` is not assignable to annotated parameter type `(T@ordered, /) -> Any`
- Found 270 diagnostics
+ Found 269 diagnostics

vision (https://github.com/pytorch/vision)
- references/depth/stereo/transforms.py:190:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[tuple[Unknown, Unknown], tuple[@Todo(Inference of subscript on special form), @Todo(Inference of subscript on special form)], tuple[@Todo(Inference of subscript on special form), @Todo(Inference of subscript on special form)]]`, found `tuple[tuple[Unknown, Unknown], tuple[Unknown, ...] | tuple[None, ...], tuple[Unknown, ...] | tuple[None, ...]]`
- references/depth/stereo/transforms.py:485:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[tuple[Unknown, Unknown], tuple[@Todo(Inference of subscript on special form), @Todo(Inference of subscript on special form)], tuple[@Todo(Inference of subscript on special form), @Todo(Inference of subscript on special form)]]`, found `tuple[tuple[Unknown, ...], tuple[Unknown, ...] | tuple[None, ...], tuple[Unknown, ...] | tuple[None, ...]]`
- torchvision/datasets/_stereo_matching.py:74:13: error[invalid-assignment] Object of type `list[str]` is not assignable to `list[None | str]`
- torchvision/models/detection/fcos.py:770:28: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `int | None`
- torchvision/models/detection/ssd.py:677:57: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `int | None`
- torchvision/models/detection/ssdlite.py:323:9: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `int | None`
- torchvision/models/detection/ssdlite.py:324:53: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `int | None`
- torchvision/models/segmentation/deeplabv3.py:276:41: error[invalid-argument-type] Argument to function `_deeplabv3_resnet` is incorrect: Expected `int`, found `int | None`
- torchvision/models/segmentation/deeplabv3.py:332:41: error[invalid-argument-type] Argument to function `_deeplabv3_resnet` is incorrect: Expected `int`, found `int | None`
- torchvision/models/segmentation/deeplabv3.py:386:46: error[invalid-argument-type] Argument to function `_deeplabv3_mobilenetv3` is incorrect: Expected `int`, found `int | None`
- torchvision/models/segmentation/fcn.py:168:35: error[invalid-argument-type] Argument to function `_fcn_resnet` is incorrect: Expected `int`, found `int | None`
- torchvision/models/segmentation/fcn.py:227:35: error[invalid-argument-type] Argument to function `_fcn_resnet` is incorrect: Expected `int`, found `int | None`
- torchvision/models/segmentation/lraspp.py:173:43: error[invalid-argument-type] Argument to function `_lraspp_mobilenetv3` is incorrect: Expected `int`, found `int | None`
- torchvision/prototype/transforms/_misc.py:34:13: error[invalid-assignment] Object of type `dict[Any, (Sequence[int] & ~dict[Unknown, Unknown]) | (dict[type, Sequence[int] | None] & ~dict[Unknown, Unknown])]` is not assignable to `Sequence[int] | dict[type, Sequence[int] | None]`
- torchvision/prototype/transforms/_misc.py:56:13: error[invalid-assignment] Object of type `dict[Any, tuple[int, int] | (dict[type, tuple[int, int] | None] & ~dict[Unknown, Unknown])]` is not assignable to `tuple[int, int] | dict[type, tuple[int, int] | None]`
- Found 1466 diagnostics
+ Found 1451 diagnostics

poetry (https://github.com/python-poetry/poetry)
- tests/installation/test_executor.py:150:29: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- Found 929 diagnostics
+ Found 928 diagnostics

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/config/schema.py:518:48: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- tests/unittests/config/test_cc_seed_random.py:34:36: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.

bandersnatch (https://github.com/pypa/bandersnatch)
- src/bandersnatch/utils.py:54:24: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 126 diagnostics
+ Found 125 diagnostics

ignite (https://github.com/pytorch/ignite)
+ tests/ignite/engine/test_deterministic.py:199:95: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(Unknown & ~None) | int`, found `None`
+ tests/ignite/engine/test_deterministic.py:231:87: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(Unknown & ~None) | int`, found `None`
+ tests/ignite/engine/test_deterministic.py:313:91: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(Unknown & ~None) | int`, found `None`
+ tests/ignite/engine/test_deterministic.py:417:99: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(Unknown & ~None) | int`, found `None`
+ tests/ignite/engine/test_deterministic.py:477:87: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(Unknown & ~None) | int`, found `None`
+ tests/ignite/engine/test_deterministic.py:530:95: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(Unknown & ~None) | int`, found `None`
- tests/ignite/engine/test_event_handlers.py:214:20: warning[possibly-unbound-attribute] Attribute `_parent` on type `Unknown | ((...) -> Unknown) | None` is possibly unbound
+ tests/ignite/engine/test_event_handlers.py:214:20: warning[possibly-unbound-attribute] Attribute `_parent` on type `Unknown | None` is possibly unbound
- Found 2109 diagnostics
+ Found 2115 diagnostics

asynq (https://github.com/quora/asynq)
- asynq/tests/test_generator.py:28:24: error[unresolved-attribute] Type `Value[str]` has no attribute `value`
+ asynq/tests/test_generator.py:28:24: error[unresolved-attribute] Type `Value[Unknown]` has no attribute `value`

dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/authorization.py:51:30: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- dragonchain/lib/dto/smart_contract_model.py:100:95: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- dragonchain/lib/dto/smart_contract_model.py:300:121: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- dragonchain/scheduler/scheduler.py:65:51: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- Found 306 diagnostics
+ Found 302 diagnostics

typeshed-stats (https://github.com/AlexWaygood/typeshed-stats)
- src/typeshed_stats/gather.py:1000:13: error[invalid-argument-type] Argument to bound method `from_lines` is incorrect: Expected `str | ((str, /) -> Pattern)`, found `<class 'GitWildMatchPattern'>`
- Found 25 diagnostics
+ Found 24 diagnostics

tornado (https://github.com/tornadoweb/tornado)
- tornado/test/httpclient_test.py:932:43: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- tornado/test/httputil_test.py:506:42: warning[deprecated] The function `utcfromtimestamp` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.timezone.utc)
- tornado/websocket.py:1022:13: error[invalid-assignment] Method `__setitem__` of type `bound method dict[str, bool].__setitem__(key: str, value: bool, /) -> None` cannot be called with a key of type `Literal["max_wbits"]` and a value of type `int` on object of type `dict[str, bool]`
- tornado/websocket.py:1024:13: error[invalid-assignment] Method `__setitem__` of type `bound method dict[str, bool].__setitem__(key: str, value: bool, /) -> None` cannot be called with a key of type `Literal["max_wbits"]` and a value of type `int` on object of type `dict[str, bool]`
- tornado/websocket.py:1025:9: error[invalid-assignment] Method `__setitem__` of type `bound method dict[str, bool].__setitem__(key: str, value: bool, /) -> None` cannot be called with a key of type `Literal["compression_options"]` and a value of type `dict[str, Any] | None` on object of type `dict[str, bool]`
- Found 244 diagnostics
+ Found 239 diagnostics

PyGithub (https://github.com/PyGithub/PyGithub)
+ github/GithubObject.py:359:102: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ github/GithubObject.py:363:95: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 313 diagnostics
+ Found 315 diagnostics

paasta (https://github.com/yelp/paasta)
- paasta_tools/cli/cmds/local_run.py:972:39: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- paasta_tools/cli/cmds/logs.py:1018:46: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- paasta_tools/cli/cmds/logs.py:1315:42: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- paasta_tools/cli/cmds/logs.py:1327:40: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- paasta_tools/cli/cmds/start_stop_restart.py:276:77: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- paasta_tools/utils.py:1514:30: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- paasta_tools/utils.py:2884:23: error[no-matching-overload] No overload of function `split` matches arguments
- paasta_tools/utils.py:3710:52: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- paasta_tools/utils.py:3718:52: warning[deprecated] The function `utcnow` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)
- paasta_tools/utils.py:4188:19: warning[redundant-cast] Value is already of type `list[str]`
- Found 889 diagnostics
+ Found 879 diagnostics

pywin32 (https://github.com/mhammond/pywin32)
- AutoDuck/fixHelpCompression.py:16:10: warning[deprecated] The function `WriteProfileVal` is deprecated: This function is obsolete, applications should use the registry instead.
- Pythonwin/pywin/framework/editor/vss.py:45:29: warning[deprecated] The function `GetProfileVal` is deprecated: This function is obsolete, applications should use the registry instead.
- Pythonwin/pywin/framework/editor/vss.py:46:28: warning[deprecated] The function `GetProfileVal` is deprecated: This function is obsolete, applications should use the registry instead.
- Pythonwin/pywin/framework/sgrepmdi.py:606:29: warning[deprecated] The function `GetProfileSection` is deprecated: This function is obsolete, applications should use the registry instead.
- Pythonwin/pywin/framework/sgrepmdi.py:620:30: warning[deprecated] The function `WriteProfileVal` is deprecated: This function is obsolete, applications should use the registry instead.
- com/win32com/server/register.py:569:25: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- com/win32com/test/testMSOffice.py:147:38: warning[deprecated] The function `MakeTime` is deprecated: Use pywintypes.Time() instead.
- com/win32com/test/testxslt.py:12:32: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- com/win32com/test/util.py:105:28: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- com/win32comext/shell/demos/create_link.py:65:13: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(str, Literal["SetPath", "SetArguments", "SetDescription", "SetWorkingDirectory"], /) -> Unknown`, found `None`
+ com/win32comext/shell/demos/create_link.py:65:13: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `(Unknown, Unknown, /) -> Unknown`, found `None`
- com/win32comext/shell/demos/servers/folder_view.py:25:18: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:91:17: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:92:17: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:93:18: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:94:18: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:99:16: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:100:17: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:101:17: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:102:17: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- com/win32comext/shell/demos/servers/folder_view.py:103:17: warning[deprecated] The function `MakeIID` is deprecated: Use pywintypes.IID() instead.
- win32/Demos/BackupSeek_streamheaders.py:133:23: error[no-matching-overload] No overload of function `BackupSeek` matches arguments
+ win32/Demos/BackupSeek_streamheaders.py:133:44: error[invalid-argument-type] Argument to function `BackupSeek` is incorrect: Expected `int`, found `PyHANDLE`
- win32/Demos/mmapfile_demo.py:12:18: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- win32/Demos/mmapfile_demo.py:54:24: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
+ win32/Demos/service/pipeTestService.py:65:9: error[missing-argument] No argument provided for required parameter `sid` of bound method `AddAccessAllowedAce`
+ win32/Demos/service/pipeTestService.py:65:73: error[invalid-argument-type] Argument to bound method `AddAccessAllowedAce` is incorrect: Expected `int`, found `PySID`
+ win32/Demos/service/pipeTestService.py:66:9: error[missing-argument] No argument provided for required parameter `sid` of bound method `AddAccessAllowedAce`
+ win32/Demos/service/pipeTestService.py:66:50: error[invalid-argument-type] Argument to bound method `AddAccessAllowedAce` is incorrect: Expected `int`, found `PySID`
- win32/Demos/winprocess.py:204:25: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- win32/Lib/win32serviceutil.py:139:28: warning[deprecated] The function `GetProfileVal` is deprecated: This function is obsolete, applications should use the registry instead.
- win32/test/test_win32file.py:99:9: error[no-matching-overload] No overload of function `SetFilePointer` matches arguments
+ win32/test/test_win32file.py:99:34: error[invalid-argument-type] Argument to function `SetFilePointer` is incorrect: Expected `int`, found `PyHANDLE`
- win32/test/test_win32file.py:109:9: error[no-matching-overload] No overload of function `SetFilePointer` matches arguments
+ win32/test/test_win32file.py:109:34: error[invalid-argument-type] Argument to function `SetFilePointer` is incorrect: Expected `int`, found `PyHANDLE`
- win32/test/test_win32file.py:159:13: error[no-matching-overload] No overload of function `SetFilePointer` matches arguments
+ win32/test/test_win32file.py:159:38: error[invalid-argument-type] Argument to function `SetFilePointer` is incorrect: Expected `int`, found `PyHANDLE`
- win32/test/test_win32file.py:166:13: error[no-matching-overload] No overload of function `SetFilePointer` matches arguments
+ win32/test/test_win32file.py:166:38: error[invalid-argument-type] Argument to function `SetFilePointer` is incorrect: Expected `int`, found `PyHANDLE`
- win32/test/test_win32file.py:176:29: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- win32/test/test_win32file.py:215:29: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- win32/test/test_win32file.py:608:27: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- win32/test/test_win32file.py:733:26: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- win32/test/test_win32rcparser.py:55:28: warning[deprecated] The function `mktemp` is deprecated: Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.
- Found 1986 diagnostics
+ Found 1962 diagnostics

schema_salad (https://github.com/common-workflow-language/schema_salad)
- docs/conf.py:22:23: warning[deprecated] The function `utcfromtimestamp` is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .fromtimestamp(datetime.timezone.utc)
- schema_salad/sourceline.py:17:33: error[invalid-argument-type] Argument to function `_add_lc_filename` is incorrect: Argument type `AnyStr@_add_lc_filename` does not satisfy constraints of type variable `AnyStr`
- schema_salad/sourceline.py:20:33: error[invalid-argument-type] Argument to function `_add_lc_fi...*[Comment body truncated]*

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Aug 26, 2025
@dcreager dcreager force-pushed the dcreager/real-constraint-sets branch from 7ddd258 to 3ae013c Compare August 26, 2025 20:30
@dcreager dcreager force-pushed the dcreager/dummy-constraint-sets branch from d5c49ba to c1441d2 Compare August 26, 2025 20:30
@codspeed-hq
Copy link

codspeed-hq bot commented Aug 26, 2025

CodSpeed Performance Report

Merging #20093 will degrade performances by 7.41%

Comparing dcreager/real-constraint-sets (cb37f7a) with main (adf095e)

Summary

❌ 4 regressions
✅ 9 untouched
⏩ 39 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
Simulation ty_check_file[incremental] 6.8 ms 7.1 ms -4.23%
Simulation anyio 1.4 s 1.5 s -7.08%
Simulation DateType 255.8 ms 276.3 ms -7.41%
Simulation hydra-zen 1.1 s 1.1 s -4.53%

Footnotes

  1. 39 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codspeed-hq

This comment was marked as outdated.

@dcreager dcreager force-pushed the dcreager/dummy-constraint-sets branch from c1441d2 to c70e3bc Compare August 27, 2025 01:59
@dcreager dcreager force-pushed the dcreager/real-constraint-sets branch 2 times, most recently from 50f4f6e to 473413f Compare August 27, 2025 14:47
@dcreager dcreager force-pushed the dcreager/dummy-constraint-sets branch from c70e3bc to f06c0f6 Compare August 27, 2025 19:15
@dcreager dcreager force-pushed the dcreager/real-constraint-sets branch 3 times, most recently from d670aa9 to 4b4fc92 Compare August 28, 2025 00:21
@dcreager dcreager force-pushed the dcreager/real-constraint-sets branch 3 times, most recently from 81cbc18 to 6514d3e Compare August 28, 2025 00:41
dcreager added a commit that referenced this pull request Aug 29, 2025
This PR adds an implementation of constraint sets.

An individual constraint restricts the specialization of a single
typevar to be within a particular lower and upper bound: the typevar can
only specialize to types that are a supertype of the lower bound, and a
subtype of the upper bound. (Note that lower and upper bounds are fully
static; we take the bottom and top materializations of the bounds to
remove any gradual forms if needed.) Either bound can be “closed” (where
the bound is a valid specialization), or “open” (where it is not).

You can then build up more complex constraint sets using union,
intersection, and negation operations. We use a disjunctive normal form
(DNF) representation, just like we do for types: a _constraint set_ is
the union of zero or more _clauses_, each of which is the intersection
of zero or more individual constraints. Note that the constraint set
that contains no clauses is never satisfiable (`⋃ {} = 0`); and the
constraint set that contains a single clause, which contains no
constraints, is always satisfiable (`⋃ {⋂ {}} = 1`).

One thing to note is that this PR does not change the logic of the
actual assignability checks, and in particular, we still aren't ever
trying to create an "individual constraint" that constrains a typevar.
Technically we're still operating only on `bool`s, since we only ever
instantiate `C::always_satisfiable` (i.e., `true`) and
`C::unsatisfiable` (i.e., `false`) in the `has_relation_to` methods. So
if you thought that #19838 introduced an unnecessarily complex stand-in
for `bool`, well here you go, this one is worse! (But still seemingly
not yielding a performance regression!) The next PR in this series,
#20093, is where we will actually create some non-trivial constraint
sets and use them in anger.

That said, the PR does go ahead and update the assignability checks to
use the new `ConstraintSet` type instead of `bool`. That part is fairly
straightforward since we had already updated the assignability checks to
use the `Constraints` trait; we just have to actively choose a different
impl type. (For the `is_whatever` variants, which still return a `bool`,
we have to convert the constraint set, but the explicit
`is_always_satisfiable` calls serve as nice documentation of our
intent.)

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Carl Meyer <carl@astral.sh>
Base automatically changed from dcreager/dummy-constraint-sets to main August 29, 2025 00:04
@dcreager dcreager force-pushed the dcreager/real-constraint-sets branch from 6514d3e to 37b0ec9 Compare August 29, 2025 00:07
@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2025

ecosystem-analyzer results

Failing projects:

Project Old Status New Status Old Return Code New Return Code
koda-validate success timeout 1 None

Diagnostic changes:

Lint rule Added Removed Changed
invalid-argument-type 20 16 1
type-assertion-failure 0 9 0
unused-ignore-comment 8 0 0
invalid-return-type 0 5 1
no-matching-overload 1 3 0
possibly-unbound-attribute 2 0 1
unsupported-operator 0 3 0
non-subscriptable 2 0 0
redundant-cast 0 1 0
Total 33 37 3

Full report with detailed diff

@dcreager dcreager force-pushed the dcreager/real-constraint-sets branch 2 times, most recently from 474b036 to ced99ce Compare September 9, 2025 14:07
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
This PR adds an implementation of constraint sets.

An individual constraint restricts the specialization of a single
typevar to be within a particular lower and upper bound: the typevar can
only specialize to types that are a supertype of the lower bound, and a
subtype of the upper bound. (Note that lower and upper bounds are fully
static; we take the bottom and top materializations of the bounds to
remove any gradual forms if needed.) Either bound can be “closed” (where
the bound is a valid specialization), or “open” (where it is not).

You can then build up more complex constraint sets using union,
intersection, and negation operations. We use a disjunctive normal form
(DNF) representation, just like we do for types: a _constraint set_ is
the union of zero or more _clauses_, each of which is the intersection
of zero or more individual constraints. Note that the constraint set
that contains no clauses is never satisfiable (`⋃ {} = 0`); and the
constraint set that contains a single clause, which contains no
constraints, is always satisfiable (`⋃ {⋂ {}} = 1`).

One thing to note is that this PR does not change the logic of the
actual assignability checks, and in particular, we still aren't ever
trying to create an "individual constraint" that constrains a typevar.
Technically we're still operating only on `bool`s, since we only ever
instantiate `C::always_satisfiable` (i.e., `true`) and
`C::unsatisfiable` (i.e., `false`) in the `has_relation_to` methods. So
if you thought that astral-sh#19838 introduced an unnecessarily complex stand-in
for `bool`, well here you go, this one is worse! (But still seemingly
not yielding a performance regression!) The next PR in this series,
astral-sh#20093, is where we will actually create some non-trivial constraint
sets and use them in anger.

That said, the PR does go ahead and update the assignability checks to
use the new `ConstraintSet` type instead of `bool`. That part is fairly
straightforward since we had already updated the assignability checks to
use the `Constraints` trait; we just have to actively choose a different
impl type. (For the `is_whatever` variants, which still return a `bool`,
we have to convert the constraint set, but the explicit
`is_always_satisfiable` calls serve as nice documentation of our
intent.)

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Carl Meyer <carl@astral.sh>
dcreager added a commit that referenced this pull request Oct 16, 2025
We have to track whether a typevar appears in a position where it's
inferable or not. In a non-inferable position (in the body of the
generic class or function that binds it), assignability must hold for
every possible specialization of the typevar. In an inferable position,
it only needs to hold for _some_ specialization.
#20093 is working on using
constraint sets to model assignability of typevars, and the constraint
sets that we produce will be the same for inferable vs non-inferable
typevars; what changes is what we _compare_ that constraint set to. (For
a non-inferable typevar, the constraint set must equal the set of valid
specializations; for an inferable typevar, it must not be `never`.)

When I first added support for tracking inferable vs non-inferable
typevars, it seemed like it would be easiest to have separate `Type`
variants for each. The alternative (which lines up with the Δ set in
[POPL15](https://doi.org/10.1145/2676726.2676991)) would be to
explicitly plumb through a list of inferable typevars through our type
property methods. That seemed cumbersome.

In retrospect, that was the wrong decision. We've had to jump through
hoops to translate types between the inferable and non-inferable
variants, which has been quite brittle. Combined with the original point
above, that much of the assignability logic will become more identical
between inferable and non-inferable, there is less justification for the
two `Type` variants. And plumbing an extra `inferable` parameter through
all of these methods turns out to not be as bad as I anticipated.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
dcreager added a commit that referenced this pull request Oct 28, 2025
This PR updates the mdtests that test how our generics solver interacts
with our new constraint set implementation. Because the rendering of a
constraint set can get long, this standardizes on putting the `revealed`
assertion on a separate line. We also add a `static_assert` test for
each constraint set to verify that they are all coerced into simple
`bool`s correctly.

This is a pure reformatting (not even a refactoring!) that changes no
behavior. I've pulled it out of #20093 to reduce the amount of effort
that will be required to review that PR.
dcreager added a commit that referenced this pull request Nov 5, 2025
…ection) (#21273)

This PR carries over some of the `has_relation_to` logic for comparing a
typevar with itself. A typevar will specialize to the same type if it's
mentioned multiple times, so it is always assignable to and a subtype of
itself. (Note that typevars can only specialize to fully static types.)
This is also true when the typevar appears in a union on the right-hand
side, or in an intersection on the left-hand side. Similarly, a typevar
is always disjoint from its negation, so when a negated typevar appears
on the left-hand side, the constraint set is never satisfiable.

(Eventually this will allow us to remove the corresponding clauses from
`has_relation_to`, but that can't happen until more of #20093 lands.)
dcreager added a commit that referenced this pull request Nov 17, 2025
Constraint sets can now track subtyping/assignability/etc of generic
callables correctly. For instance:

```py
def identity[T](t: T) -> T:
    return t

constraints = ConstraintSet.always()
static_assert(constraints.implies_subtype_of(TypeOf[identity], Callable[[int], int]))
static_assert(constraints.implies_subtype_of(TypeOf[identity], Callable[[str], str]))
```

A generic callable can be considered an intersection of all of its
possible specializations, and an assignability check with an
intersection as the lhs side succeeds of _any_ of the intersected types
satisfies the check. Put another way, if someone expects to receive any
function with a signature of `(int) -> int`, we can give them
`identity`.

Note that the corresponding check using `is_subtype_of` directly does
not yet work, since #20093 has not yet hooked up the core typing
relationship logic to use constraint sets:

```py
# These currently fail
static_assert(is_subtype_of(TypeOf[identity], Callable[[int], int]))
static_assert(is_subtype_of(TypeOf[identity], Callable[[str], str]))
```

To do this, we add a new _existential quantification_ operation on
constraint sets. This takes in a list of typevars and _removes_ those
typevars from the constraint set. Conceptually, we return a new
constraint set that evaluates to `true` when there was _any_ assignment
of the removed typevars that caused the old constraint set to evaluate
to `true`.

When comparing a generic constraint set, we add its typevars to the
`inferable` set, and figure out whatever constraints would allow any
specialization to satisfy the check. We then use the new existential
quantification operator to remove those new typevars, since the caller
doesn't (and shouldn't) know anything about them.

---------

Co-authored-by: David Peter <sharkdp@users.noreply.github.com>
@dcreager dcreager force-pushed the dcreager/real-constraint-sets branch from 519a9c3 to 8e754a4 Compare November 24, 2025 14:56
@dcreager dcreager changed the base branch from main to dcreager/unconstrained-typevar November 24, 2025 14:57
Base automatically changed from dcreager/unconstrained-typevar to main November 24, 2025 20:23
@dcreager dcreager force-pushed the dcreager/real-constraint-sets branch from 8e754a4 to 3bc3ced Compare November 24, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants