Mv core mods to `runtime/`, `spawn/`, `discovery/` subpkgs

Restructure the flat `tractor/` top-level private mods
into (more nested) subpackages:

- `runtime/`: `_runtime`, `_portal`, `_rpc`, `_state`,
  `_supervise`
- `spawn/`: `_spawn`, `_entry`, `_forkserver_override`,
  `_mp_fixup_main`
- `discovery/`: `_addr`, `_discovery`, `_multiaddr`

Each subpkg `__init__.py` is kept lazy (no eager
imports) to avoid circular import issues.

Also,
- update all intra-pkg imports across ~35 mods to use
  the new subpkg paths (e.g. `from .runtime._state`
  instead of `from ._state`)

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
multicast_revertable_streams
Gud Boi 2026-03-23 18:42:16 -04:00
parent 6827ceba12
commit cc42d38284
38 changed files with 197 additions and 121 deletions

View File

@ -30,17 +30,17 @@ from ._streaming import (
MsgStream as MsgStream, MsgStream as MsgStream,
stream as stream, stream as stream,
) )
from ._discovery import ( from .discovery._discovery import (
get_registry as get_registry, get_registry as get_registry,
find_actor as find_actor, find_actor as find_actor,
wait_for_actor as wait_for_actor, wait_for_actor as wait_for_actor,
query_actor as query_actor, query_actor as query_actor,
) )
from ._supervise import ( from .runtime._supervise import (
open_nursery as open_nursery, open_nursery as open_nursery,
ActorNursery as ActorNursery, ActorNursery as ActorNursery,
) )
from ._state import ( from .runtime._state import (
RuntimeVars as RuntimeVars, RuntimeVars as RuntimeVars,
current_actor as current_actor, current_actor as current_actor,
current_ipc_ctx as current_ipc_ctx, current_ipc_ctx as current_ipc_ctx,
@ -67,6 +67,6 @@ from ._root import (
open_root_actor as open_root_actor, open_root_actor as open_root_actor,
) )
from .ipc import Channel as Channel from .ipc import Channel as Channel
from ._portal import Portal as Portal from .runtime._portal import Portal as Portal
from ._runtime import Actor as Actor from .runtime._runtime import Actor as Actor
# from . import hilevel as hilevel # from . import hilevel as hilevel

View File

@ -22,8 +22,8 @@ import argparse
from ast import literal_eval from ast import literal_eval
from ._runtime import Actor from .runtime._runtime import Actor
from ._entry import _trio_main from .spawn._entry import _trio_main
def parse_uid(arg): def parse_uid(arg):

View File

@ -97,7 +97,7 @@ from ._streaming import (
MsgStream, MsgStream,
open_stream_from_ctx, open_stream_from_ctx,
) )
from ._state import ( from .runtime._state import (
current_actor, current_actor,
debug_mode, debug_mode,
_ctxvar_Context, _ctxvar_Context,
@ -107,8 +107,8 @@ from .trionics import (
) )
# ------ - ------ # ------ - ------
if TYPE_CHECKING: if TYPE_CHECKING:
from ._portal import Portal from .runtime._portal import Portal
from ._runtime import Actor from .runtime._runtime import Actor
from .ipc._transport import MsgTransport from .ipc._transport import MsgTransport
from .devx._frame_stack import ( from .devx._frame_stack import (
CallerInfo, CallerInfo,

View File

@ -43,7 +43,7 @@ from msgspec import (
ValidationError, ValidationError,
) )
from tractor._state import current_actor from tractor.runtime._state import current_actor
from tractor.log import get_logger from tractor.log import get_logger
from tractor.msg import ( from tractor.msg import (
Error, Error,

View File

@ -37,19 +37,19 @@ import warnings
import trio import trio
from . import _runtime from .runtime import _runtime
from .devx import ( from .devx import (
debug, debug,
_frame_stack, _frame_stack,
pformat as _pformat, pformat as _pformat,
) )
from . import _spawn from .spawn import _spawn
from . import _state from .runtime import _state
from . import log from . import log
from .ipc import ( from .ipc import (
_connect_chan, _connect_chan,
) )
from ._addr import ( from .discovery._addr import (
Address, Address,
UnwrappedAddress, UnwrappedAddress,
default_lo_addrs, default_lo_addrs,

View File

@ -55,7 +55,7 @@ from tractor.msg import (
) )
if TYPE_CHECKING: if TYPE_CHECKING:
from ._runtime import Actor from .runtime._runtime import Actor
from ._context import Context from ._context import Context
from .ipc import Channel from .ipc import Channel

View File

@ -26,9 +26,7 @@ import random
from typing import ( from typing import (
Type, Type,
) )
from tractor import ( from tractor.discovery import _addr
_addr,
)
def get_rando_addr( def get_rando_addr(

View File

@ -45,17 +45,15 @@ from typing import (
) )
import trio import trio
from tractor import ( from tractor.runtime import _state
_state, from tractor import log as logmod
log as logmod,
)
from tractor.devx import debug from tractor.devx import debug
log = logmod.get_logger() log = logmod.get_logger()
if TYPE_CHECKING: if TYPE_CHECKING:
from tractor._spawn import ProcessType from tractor.spawn._spawn import ProcessType
from tractor import ( from tractor import (
Actor, Actor,
ActorNursery, ActorNursery,

View File

@ -53,8 +53,8 @@ import trio
from tractor._exceptions import ( from tractor._exceptions import (
NoRuntime, NoRuntime,
) )
from tractor import _state from tractor.runtime import _state
from tractor._state import ( from tractor.runtime._state import (
current_actor, current_actor,
debug_mode, debug_mode,
) )
@ -76,7 +76,7 @@ from ._repl import (
if TYPE_CHECKING: if TYPE_CHECKING:
from trio.lowlevel import Task from trio.lowlevel import Task
from tractor._runtime import ( from tractor.runtime._runtime import (
Actor, Actor,
) )

View File

@ -25,7 +25,7 @@ from functools import (
import os import os
import pdbp import pdbp
from tractor._state import ( from tractor.runtime._state import (
is_root_process, is_root_process,
) )

View File

@ -27,7 +27,7 @@ from typing import (
) )
import trio import trio
from tractor.log import get_logger from tractor.log import get_logger
from tractor._state import ( from tractor.runtime._state import (
current_actor, current_actor,
is_root_process, is_root_process,
) )
@ -44,7 +44,7 @@ if TYPE_CHECKING:
from tractor.ipc import ( from tractor.ipc import (
Channel, Channel,
) )
from tractor._runtime import ( from tractor.runtime._runtime import (
Actor, Actor,
) )

View File

@ -40,7 +40,7 @@ from trio.lowlevel import (
Task, Task,
) )
from tractor._context import Context from tractor._context import Context
from tractor._state import ( from tractor.runtime._state import (
current_actor, current_actor,
debug_mode, debug_mode,
is_root_process, is_root_process,

View File

@ -55,12 +55,12 @@ import tractor
from tractor.log import get_logger from tractor.log import get_logger
from tractor.to_asyncio import run_trio_task_in_future from tractor.to_asyncio import run_trio_task_in_future
from tractor._context import Context from tractor._context import Context
from tractor import _state from tractor.runtime import _state
from tractor._exceptions import ( from tractor._exceptions import (
NoRuntime, NoRuntime,
InternalError, InternalError,
) )
from tractor._state import ( from tractor.runtime._state import (
current_actor, current_actor,
current_ipc_ctx, current_ipc_ctx,
is_root_process, is_root_process,
@ -87,7 +87,7 @@ from ..pformat import (
if TYPE_CHECKING: if TYPE_CHECKING:
from trio.lowlevel import Task from trio.lowlevel import Task
from threading import Thread from threading import Thread
from tractor._runtime import ( from tractor.runtime._runtime import (
Actor, Actor,
) )
# from ._post_mortem import BoxedMaybeException # from ._post_mortem import BoxedMaybeException

View File

@ -55,12 +55,12 @@ import tractor
from tractor.to_asyncio import run_trio_task_in_future from tractor.to_asyncio import run_trio_task_in_future
from tractor.log import get_logger from tractor.log import get_logger
from tractor._context import Context from tractor._context import Context
from tractor import _state from tractor.runtime import _state
from tractor._exceptions import ( from tractor._exceptions import (
DebugRequestError, DebugRequestError,
InternalError, InternalError,
) )
from tractor._state import ( from tractor.runtime._state import (
current_actor, current_actor,
is_root_process, is_root_process,
) )
@ -71,7 +71,7 @@ if TYPE_CHECKING:
from tractor.ipc import ( from tractor.ipc import (
IPCServer, IPCServer,
) )
from tractor._runtime import ( from tractor.runtime._runtime import (
Actor, Actor,
) )
from ._repl import ( from ._repl import (
@ -1013,7 +1013,7 @@ async def request_root_stdio_lock(
DebugStatus.req_task = current_task() DebugStatus.req_task = current_task()
req_err: BaseException|None = None req_err: BaseException|None = None
try: try:
from tractor._discovery import get_root from tractor.discovery._discovery import get_root
# NOTE: we need this to ensure that this task exits # NOTE: we need this to ensure that this task exits
# BEFORE the REPl instance raises an error like # BEFORE the REPl instance raises an error like
# `bdb.BdbQuit` directly, OW you get a trio cs stack # `bdb.BdbQuit` directly, OW you get a trio cs stack

View File

@ -0,0 +1,26 @@
# tractor: structured concurrent "actors".
# Copyright 2018-eternity Tyler Goodlet.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
Discovery (protocols) API for automatic addressing
and location management of (service) actors.
NOTE: to avoid circular imports, this ``__init__``
does NOT eagerly import submodules. Use direct
module paths like ``tractor.discovery._addr`` or
``tractor.discovery._discovery`` instead.
'''

View File

@ -27,15 +27,15 @@ from trio import (
SocketListener, SocketListener,
) )
from .log import get_logger from ..log import get_logger
from ._state import ( from ..runtime._state import (
_def_tpt_proto, _def_tpt_proto,
) )
from .ipc._tcp import TCPAddress from ..ipc._tcp import TCPAddress
from .ipc._uds import UDSAddress from ..ipc._uds import UDSAddress
if TYPE_CHECKING: if TYPE_CHECKING:
from ._runtime import Actor from ..runtime._runtime import Actor
log = get_logger() log = get_logger()

View File

@ -28,29 +28,29 @@ from typing import (
from contextlib import asynccontextmanager as acm from contextlib import asynccontextmanager as acm
from tractor.log import get_logger from tractor.log import get_logger
from .trionics import ( from ..trionics import (
gather_contexts, gather_contexts,
collapse_eg, collapse_eg,
) )
from .ipc import _connect_chan, Channel from ..ipc import _connect_chan, Channel
from ._addr import ( from ._addr import (
UnwrappedAddress, UnwrappedAddress,
Address, Address,
wrap_address wrap_address
) )
from ._portal import ( from ..runtime._portal import (
Portal, Portal,
open_portal, open_portal,
LocalPortal, LocalPortal,
) )
from ._state import ( from ..runtime._state import (
current_actor, current_actor,
_runtime_vars, _runtime_vars,
_def_tpt_proto, _def_tpt_proto,
) )
if TYPE_CHECKING: if TYPE_CHECKING:
from ._runtime import Actor from ..runtime._runtime import Actor
log = get_logger() log = get_logger()

View File

@ -244,8 +244,12 @@ def pub(
task2lock[name] = trio.StrictFIFOLock() task2lock[name] = trio.StrictFIFOLock()
@wrapt.decorator @wrapt.decorator
async def wrapper(agen, instance, args, kwargs): async def wrapper(
agen,
instance,
args,
kwargs,
):
# XXX: this is used to extract arguments properly as per the # XXX: this is used to extract arguments properly as per the
# `wrapt` docs # `wrapt` docs
async def _execute( async def _execute(

View File

@ -39,7 +39,7 @@ from ._types import (
transport_from_addr, transport_from_addr,
transport_from_stream, transport_from_stream,
) )
from tractor._addr import ( from tractor.discovery._addr import (
is_wrapped_addr, is_wrapped_addr,
wrap_address, wrap_address,
Address, Address,

View File

@ -50,26 +50,24 @@ from ..devx.pformat import (
from .._exceptions import ( from .._exceptions import (
TransportClosed, TransportClosed,
) )
from .. import _rpc from ..runtime import _rpc
from ..msg import ( from ..msg import (
MsgType, MsgType,
Struct, Struct,
types as msgtypes, types as msgtypes,
) )
from ..trionics import maybe_open_nursery from ..trionics import maybe_open_nursery
from .. import ( from ..runtime import _state
_state, from .. import log
log, from ..discovery._addr import Address
)
from .._addr import Address
from ._chan import Channel from ._chan import Channel
from ._transport import MsgTransport from ._transport import MsgTransport
from ._uds import UDSAddress from ._uds import UDSAddress
from ._tcp import TCPAddress from ._tcp import TCPAddress
if TYPE_CHECKING: if TYPE_CHECKING:
from .._runtime import Actor from ..runtime._runtime import Actor
from .._supervise import ActorNursery from ..runtime._supervise import ActorNursery
log = log.get_logger() log = log.get_logger()
@ -970,7 +968,7 @@ class Server(Struct):
in `accept_addrs`. in `accept_addrs`.
''' '''
from .._addr import ( from ..discovery._addr import (
default_lo_addrs, default_lo_addrs,
wrap_address, wrap_address,
) )

View File

@ -54,7 +54,7 @@ from tractor.msg import (
) )
if TYPE_CHECKING: if TYPE_CHECKING:
from tractor._addr import Address from tractor.discovery._addr import Address
log = get_logger() log = get_logger()

View File

@ -53,14 +53,14 @@ from tractor.log import get_logger
from tractor.ipc._transport import ( from tractor.ipc._transport import (
MsgpackTransport, MsgpackTransport,
) )
from tractor._state import ( from tractor.runtime._state import (
get_rt_dir, get_rt_dir,
current_actor, current_actor,
is_root_process, is_root_process,
) )
if TYPE_CHECKING: if TYPE_CHECKING:
from ._runtime import Actor from tractor.runtime._runtime import Actor
# Platform-specific credential passing constants # Platform-specific credential passing constants

View File

@ -47,7 +47,7 @@ import colorlog # type: ignore
# import colored_traceback.auto # ?TODO, need better config? # import colored_traceback.auto # ?TODO, need better config?
import trio import trio
from ._state import current_actor from .runtime._state import current_actor
_default_loglevel: str = 'ERROR' _default_loglevel: str = 'ERROR'

View File

@ -50,7 +50,7 @@ from tractor._exceptions import (
_mk_recv_mte, _mk_recv_mte,
pack_error, pack_error,
) )
from tractor._state import ( from tractor.runtime._state import (
current_ipc_ctx, current_ipc_ctx,
) )
from ._codec import ( from ._codec import (

View File

@ -0,0 +1,26 @@
# tractor: structured concurrent "actors".
# Copyright 2018-eternity Tyler Goodlet.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
The actor runtime: core machinery for the
actor-model implemented on a `trio` task runtime.
NOTE: to avoid circular imports, this ``__init__``
does NOT eagerly import submodules. Use direct
module paths like ``tractor.runtime._state`` or
``tractor.runtime._runtime`` instead.
'''

View File

@ -39,30 +39,30 @@ import warnings
import trio import trio
from .trionics import ( from ..trionics import (
maybe_open_nursery, maybe_open_nursery,
collapse_eg, collapse_eg,
) )
from ._state import ( from ._state import (
current_actor, current_actor,
) )
from .ipc import Channel from ..ipc import Channel
from .log import get_logger from ..log import get_logger
from .msg import ( from ..msg import (
# Error, # Error,
PayloadMsg, PayloadMsg,
NamespacePath, NamespacePath,
Return, Return,
) )
from ._exceptions import ( from .._exceptions import (
NoResult, NoResult,
TransportClosed, TransportClosed,
) )
from ._context import ( from .._context import (
Context, Context,
open_context_from_portal, open_context_from_portal,
) )
from ._streaming import ( from .._streaming import (
MsgStream, MsgStream,
) )

View File

@ -43,11 +43,11 @@ from trio import (
TaskStatus, TaskStatus,
) )
from .ipc import Channel from ..ipc import Channel
from ._context import ( from .._context import (
Context, Context,
) )
from ._exceptions import ( from .._exceptions import (
ContextCancelled, ContextCancelled,
RemoteActorError, RemoteActorError,
ModuleNotExposed, ModuleNotExposed,
@ -56,19 +56,19 @@ from ._exceptions import (
pack_error, pack_error,
unpack_error, unpack_error,
) )
from .trionics import ( from ..trionics import (
collapse_eg, collapse_eg,
is_multi_cancelled, is_multi_cancelled,
maybe_raise_from_masking_exc, maybe_raise_from_masking_exc,
) )
from .devx import ( from ..devx import (
debug, debug,
add_div, add_div,
pformat as _pformat, pformat as _pformat,
) )
from . import _state from . import _state
from .log import get_logger from ..log import get_logger
from .msg import ( from ..msg import (
current_codec, current_codec,
MsgCodec, MsgCodec,
PayloadT, PayloadT,

View File

@ -84,46 +84,46 @@ from tractor.msg import (
pretty_struct, pretty_struct,
types as msgtypes, types as msgtypes,
) )
from .trionics import ( from ..trionics import (
collapse_eg, collapse_eg,
maybe_open_nursery, maybe_open_nursery,
) )
from .ipc import ( from ..ipc import (
Channel, Channel,
# IPCServer, # causes cycles atm.. # IPCServer, # causes cycles atm..
_server, _server,
) )
from ._addr import ( from ..discovery._addr import (
UnwrappedAddress, UnwrappedAddress,
Address, Address,
# default_lo_addrs, # default_lo_addrs,
get_address_cls, get_address_cls,
wrap_address, wrap_address,
) )
from ._context import ( from .._context import (
mk_context, mk_context,
Context, Context,
) )
from .log import get_logger from ..log import get_logger
from ._exceptions import ( from .._exceptions import (
ContextCancelled, ContextCancelled,
InternalError, InternalError,
ModuleNotExposed, ModuleNotExposed,
MsgTypeError, MsgTypeError,
unpack_error, unpack_error,
) )
from .devx import ( from ..devx import (
debug, debug,
pformat as _pformat pformat as _pformat
) )
from ._discovery import get_registry from ..discovery._discovery import get_registry
from ._portal import Portal from ._portal import Portal
from . import _state from . import _state
from . import _mp_fixup_main from ..spawn import _mp_fixup_main
from . import _rpc from . import _rpc
if TYPE_CHECKING: if TYPE_CHECKING:
from ._supervise import ActorNursery from ._supervise import ActorNursery # noqa
from trio._channel import MemoryChannelState from trio._channel import MemoryChannelState
@ -908,7 +908,7 @@ class Actor:
# TODO! -[ ] another `Struct` for rtvs.. # TODO! -[ ] another `Struct` for rtvs..
rvs: dict[str, Any] = spawnspec._runtime_vars rvs: dict[str, Any] = spawnspec._runtime_vars
if rvs['_debug_mode']: if rvs['_debug_mode']:
from .devx import ( from ..devx import (
enable_stack_on_sig, enable_stack_on_sig,
maybe_init_greenback, maybe_init_greenback,
) )

View File

@ -40,7 +40,7 @@ from msgspec import (
if TYPE_CHECKING: if TYPE_CHECKING:
from ._runtime import Actor from ._runtime import Actor
from ._context import Context from .._context import Context
# default IPC transport protocol settings # default IPC transport protocol settings
@ -182,7 +182,7 @@ def current_actor(
_current_actor is None _current_actor is None
): ):
msg: str = 'No local actor has been initialized yet?\n' msg: str = 'No local actor has been initialized yet?\n'
from ._exceptions import NoRuntime from .._exceptions import NoRuntime
if last := last_actor(): if last := last_actor():
msg += ( msg += (
@ -248,7 +248,7 @@ def current_ipc_ctx(
not ctx not ctx
and error_on_not_set and error_on_not_set
): ):
from ._exceptions import InternalError from .._exceptions import InternalError
raise InternalError( raise InternalError(
'No IPC context has been allocated for this task yet?\n' 'No IPC context has been allocated for this task yet?\n'
f'|_{current_task()}\n' f'|_{current_task()}\n'

View File

@ -30,36 +30,36 @@ import warnings
import trio import trio
from .devx import ( from ..devx import (
debug, debug,
pformat as _pformat, pformat as _pformat,
) )
from ._addr import ( from ..discovery._addr import (
UnwrappedAddress, UnwrappedAddress,
mk_uuid, mk_uuid,
) )
from ._state import current_actor, is_main_process from ._state import current_actor, is_main_process
from .log import get_logger, get_loglevel from ..log import get_logger, get_loglevel
from ._runtime import Actor from ._runtime import Actor
from ._portal import Portal from ._portal import Portal
from .trionics import ( from ..trionics import (
is_multi_cancelled, is_multi_cancelled,
collapse_eg, collapse_eg,
) )
from ._exceptions import ( from .._exceptions import (
ContextCancelled, ContextCancelled,
) )
from ._root import ( from .._root import (
open_root_actor, open_root_actor,
) )
from . import _state from . import _state
from . import _spawn from ..spawn import _spawn
if TYPE_CHECKING: if TYPE_CHECKING:
import multiprocessing as mp import multiprocessing as mp
# from .ipc._server import IPCServer # from ..ipc._server import IPCServer
from .ipc import IPCServer from ..ipc import IPCServer
log = get_logger() log = get_logger()

View File

@ -0,0 +1,26 @@
# tractor: structured concurrent "actors".
# Copyright 2018-eternity Tyler Goodlet.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
Actor process spawning machinery using
multiple backends (trio, multiprocessing).
NOTE: to avoid circular imports, this ``__init__``
does NOT eagerly import submodules. Use direct
module paths like ``tractor.spawn._spawn`` or
``tractor.spawn._entry`` instead.
'''

View File

@ -29,19 +29,19 @@ from typing import (
import trio # type: ignore import trio # type: ignore
from .log import ( from ..log import (
get_console_log, get_console_log,
get_logger, get_logger,
) )
from . import _state from ..runtime import _state
from .devx import ( from ..devx import (
_frame_stack, _frame_stack,
pformat, pformat,
) )
# from .msg import pretty_struct # from ..msg import pretty_struct
from .to_asyncio import run_as_asyncio_guest from ..to_asyncio import run_as_asyncio_guest
from ._addr import UnwrappedAddress from ..discovery._addr import UnwrappedAddress
from ._runtime import ( from ..runtime._runtime import (
async_main, async_main,
Actor, Actor,
) )

View File

@ -125,7 +125,7 @@ class PatchedForkServer(ForkServer):
self._forkserver_pid = None self._forkserver_pid = None
# XXX only thing that changed! # XXX only thing that changed!
cmd = ('from tractor._forkserver_override import main; ' + cmd = ('from tractor.spawn._forkserver_override import main; ' +
'main(%d, %d, %r, **%r)') 'main(%d, %d, %r, **%r)')
if self._preload_modules: if self._preload_modules:

View File

@ -34,11 +34,11 @@ from typing import (
import trio import trio
from trio import TaskStatus from trio import TaskStatus
from .devx import ( from ..devx import (
debug, debug,
pformat as _pformat pformat as _pformat
) )
from tractor._state import ( from tractor.runtime._state import (
current_actor, current_actor,
is_main_process, is_main_process,
is_root_process, is_root_process,
@ -46,10 +46,10 @@ from tractor._state import (
_runtime_vars, _runtime_vars,
) )
from tractor.log import get_logger from tractor.log import get_logger
from tractor._addr import UnwrappedAddress from tractor.discovery._addr import UnwrappedAddress
from tractor._portal import Portal from tractor.runtime._portal import Portal
from tractor._runtime import Actor from tractor.runtime._runtime import Actor
from tractor._entry import _mp_main from ._entry import _mp_main
from tractor._exceptions import ActorFailure from tractor._exceptions import ActorFailure
from tractor.msg import ( from tractor.msg import (
types as msgtypes, types as msgtypes,
@ -58,11 +58,11 @@ from tractor.msg import (
if TYPE_CHECKING: if TYPE_CHECKING:
from ipc import ( from tractor.ipc import (
_server, _server,
Channel, Channel,
) )
from ._supervise import ActorNursery from tractor.runtime._supervise import ActorNursery
ProcessType = TypeVar('ProcessType', mp.Process, trio.Process) ProcessType = TypeVar('ProcessType', mp.Process, trio.Process)

View File

@ -43,7 +43,7 @@ from tractor._exceptions import (
AsyncioTaskExited, AsyncioTaskExited,
AsyncioCancelled, AsyncioCancelled,
) )
from tractor._state import ( from tractor.runtime._state import (
debug_mode, debug_mode,
_runtime_vars, _runtime_vars,
) )

View File

@ -37,7 +37,7 @@ from typing import (
) )
import trio import trio
from tractor._state import current_actor from tractor.runtime._state import current_actor
from tractor.log import get_logger from tractor.log import get_logger
# from ._beg import collapse_eg # from ._beg import collapse_eg
# from ._taskc import ( # from ._taskc import (