Skip to content

Better expose Nursery and TaskStatus for type annotations #778

@goodboy

Description

@goodboy

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions