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

TypeVarTuple support #2859

Closed
Zac-HD opened this issue Mar 14, 2023 · 1 comment · Fixed by #2881
Closed

TypeVarTuple support #2859

Zac-HD opened this issue Mar 14, 2023 · 1 comment · Fixed by #2881
Labels
typing Adding static types to trio's interface

Comments

@Zac-HD
Copy link
Member

Zac-HD commented Mar 14, 2023

We can't just use Callable[[], Awaitable[T] because we might also accept positional arguments, but either ParamSpec or overloads for zero-to-five positional arguments should work. (the latter because paramspec probably gets kwargs wrong here)

@oremanj
Copy link
Member

oremanj commented Mar 28, 2023

You need TypeVarTuple to type this correctly. mypy doesn't support it yet: python/mypy#12280

If you use the plugin ([mypy] plugins = trio_typing.plugin) then you should get correct type-checking for these calls. There are a number of different functions in trio that have this signature and I wasn't keen on maintaining N-ary overloads for all of them.

@A5rocks A5rocks transferred this issue from python-trio/trio-typing Nov 4, 2023
@A5rocks A5rocks added the typing Adding static types to trio's interface label Nov 4, 2023
@jakkdl jakkdl changed the title trio.run() and nursery.start[_soon](f, ...) should not typecheck if f is missing required arguments TypeVarTuple support Nov 4, 2023
@TeamSpen210 TeamSpen210 linked a pull request Nov 19, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants