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

Better expose Nursery and TaskStatus for type annotations #778

Closed
goodboy opened this issue Nov 17, 2018 · 2 comments
Closed

Better expose Nursery and TaskStatus for type annotations #778

goodboy opened this issue Nov 17, 2018 · 2 comments

Comments

@goodboy
Copy link
Member

goodboy commented Nov 17, 2018

As per some gitter banter we should more publicly expose the Nursery, CancelScope and Taskstatus types for use as type annotations.

Currently client code is stuck importing most of these from internal private modules which leads the following beauty:

async def _async_main(                                                                                                                                                                              
   self,                                                                                                                                                                                           
   accept_addr: Tuple[str, int],                                                                                                                                                                   
   arbiter_addr: Optional[Tuple[str, int]] = None,                                                                                                                                                 
   parent_addr: Optional[Tuple[str, int]] = None,                                                                                                                                                  
   task_status: trio._core._run._TaskStatus = trio.TASK_STATUS_IGNORED,                                                                                                                            
) -> None:
     ...

Worth noting:

@goodboy
Copy link
Member Author

goodboy commented Nov 27, 2018

Oh, and let's not forget about the very important Task!

@goodboy goodboy changed the title Better expose Nursery, CancelScope and TaskStatus for type annotations Better expose Nursery, CancelScope, Task and TaskStatus for type annotations Nov 27, 2018
@oremanj oremanj changed the title Better expose Nursery, CancelScope, Task and TaskStatus for type annotations Better expose Nursery and TaskStatus for type annotations May 1, 2019
@oremanj
Copy link
Member

oremanj commented May 1, 2019

Task is already public as trio.hazmat.Task -- how were you envisioning it getting more public?

For now I recommend using the Nursery and TaskStatus exposures in trio-typing. When we bring the type hints into Trio proper (#543), I imagine a resolution to this issue will go along with it. I'm going to close this for now, but leave a pointer at #543.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants