Skip to content

Better expose Nursery and TaskStatus for type annotations #778

Closed

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:

Activity

  1. goodboy commented on Nov 27, 2018

    @goodboy
    MemberAuthor

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

  2. changed the title [-]Better expose Nursery, CancelScope and TaskStatus for type annotations[/-] [+]Better expose Nursery, CancelScope, Task and TaskStatus for type annotations[/+] on Nov 27, 2018
  3. changed the title [-]Better expose Nursery, CancelScope, Task and TaskStatus for type annotations[/-] [+]Better expose Nursery and TaskStatus for type annotations[/+] on May 1, 2019
  4. oremanj commented on May 1, 2019

    @oremanj
    Member

    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

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