Open jakkdl opened 4 months ago
A while back I tried writing code to generate those required overloads, just rebased it. It's very ugly, but I think it works with the exception of DTLSEndpoint.serve()
. That's also using a variadic generic, I guess the layers of inference required became too much.
If we do go the overload route, remember that overload compatibility checks are quadratic. While I'm not sure it will affect users (I don't think mypy at least runs the compat checks cause the errors won't be reported anyways?), we should still make sure it doesn't balloon type checking time for developing trio.
Did the trio-typing plugin do something smarter than just generate a bunch of overloads? If so maybe we could strip it down to solely that functionality [and incorporate it here].
Although perhaps somebody should just try and contribute the feature upstream, although ilevkivskyi saying it would be tedious is a bit worrying.
2881 attempted to add
TypeVarTuple
to the signature ofNursery.start
but hit problems and ended up blocked by https://github.com/python/mypy/issues/16522I'm opening this issue so we can track it on our end as well, or possibly discuss alternate ways of adding type hints. We could consider having a million overloads like trio-typing did as a stop-gap.
Equivalent anyio issue: https://github.com/agronholm/anyio/issues/678