Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeVarTuple to Nursery.start #3023

Open
jakkdl opened this issue Jun 26, 2024 · 3 comments
Open

Add TypeVarTuple to Nursery.start #3023

jakkdl opened this issue Jun 26, 2024 · 3 comments
Labels
typing Adding static types to trio's interface

Comments

@jakkdl
Copy link
Member

jakkdl commented Jun 26, 2024

#2881 attempted to add TypeVarTuple to the signature of Nursery.start but hit problems and ended up blocked by python/mypy#16522
I'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: agronholm/anyio#678

@jakkdl jakkdl added the typing Adding static types to trio's interface label Jun 26, 2024
@TeamSpen210
Copy link
Contributor

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.

@A5rocks
Copy link
Contributor

A5rocks commented Jun 27, 2024

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.

@jakkdl
Copy link
Member Author

jakkdl commented Jun 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typing Adding static types to trio's interface
Projects
None yet
Development

No branches or pull requests

3 participants