Closed Hnasar closed 10 months ago
Since trio 0.23 we've added inline types, and once mypy releases support for TypeVarTuples (which should be in the next release afaict) I think we can fully deprecate the plugin. It would maybe be good to do a final release of trio-typing which is compatible with mypy 1.7, but I haven't touched the plugin previously myself so am not especially tempted to try and debug this thing in particular.
Is there any particular functionality you're after the plugin provides that's not provided by using trio 0.23 and current mypy?
Mypy 1.7 is the release that supports TypeVarTuple actually, so we should start adding those.
Ooh, in that case it would work to mark trio-typing
as requiring mypy<1.7
When the
trio_typing.plugin
is enabled with mypy 1.7, it can cause false positive errors (even when trio is not even in use) related to Mypy's new type inference which was enabled by default in https://github.com/python/mypy/pull/16345 for mypy 1.7.When linting async functions that take generic callables, the new type inference appears to automatically infer the variance of typevars. For example: https://mypy-play.net/?mypy=latest&python=3.11&gist=73fc0a0b94a3f2410080c0482df7ecab Outputs:
But if you add
# mypy: old-type-inference
to the top: https://mypy-play.net/?mypy=latest&python=3.11&gist=be6764bbead8f238976dd1be12d8d7e8 then it outputs:When the new type inference is used with a config file that enables the plugin
then an error is reported for this code: