diff --git a/tractor/__init__.py b/tractor/__init__.py index adaad38..7ee58ce 100644 --- a/tractor/__init__.py +++ b/tractor/__init__.py @@ -22,6 +22,7 @@ from ._exceptions import RemoteActorError, ModuleNotExposed from ._debug import breakpoint, post_mortem from . import _spawn from . import msg +from . import to_asyncio __all__ = [ @@ -38,7 +39,8 @@ __all__ = [ 'MultiError', 'RemoteActorError', 'ModuleNotExposed', - 'msg' + 'msg', + 'to_asyncio', ] diff --git a/tractor/_trionics.py b/tractor/_trionics.py index 203a9dc..e0610bc 100644 --- a/tractor/_trionics.py +++ b/tractor/_trionics.py @@ -56,6 +56,7 @@ class ActorNursery: rpc_module_paths: List[str] = None, loglevel: str = None, # set log level per subactor nursery: trio.Nursery = None, + infect_asyncio: bool = False, ) -> Portal: loglevel = loglevel or self._actor.loglevel or get_loglevel() @@ -89,6 +90,7 @@ class ActorNursery: bind_addr, parent_addr, _rtv, # run time vars + infect_asyncio=infect_asyncio, ) ) @@ -101,6 +103,7 @@ class ActorNursery: rpc_module_paths: Optional[List[str]] = None, statespace: Dict[str, Any] = None, loglevel: str = None, # set log level per subactor + infect_asyncio: bool = False, **kwargs, # explicit args to ``fn`` ) -> Portal: """Spawn a new actor, run a lone task, then terminate the actor and @@ -119,6 +122,7 @@ class ActorNursery: loglevel=loglevel, # use the run_in_actor nursery nursery=self._ria_nursery, + infect_asyncio=infect_asyncio, ) # this marks the actor to be cancelled after its portal result # is retreived, see logic in `open_nursery()` below.