2021-12-13 18:08:32 +00:00
|
|
|
# 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/>.
|
|
|
|
|
|
2018-06-07 04:26:49 +00:00
|
|
|
"""
|
2023-04-14 20:23:47 +00:00
|
|
|
tractor: structured concurrent ``trio``-"actors".
|
2021-12-13 18:08:32 +00:00
|
|
|
|
2018-06-07 04:26:49 +00:00
|
|
|
"""
|
2024-01-02 15:25:17 +00:00
|
|
|
|
|
|
|
|
from ._clustering import (
|
|
|
|
|
open_actor_cluster as open_actor_cluster,
|
|
|
|
|
)
|
2023-04-14 20:23:47 +00:00
|
|
|
from ._context import (
|
2024-01-02 15:25:17 +00:00
|
|
|
Context as Context, # the type
|
|
|
|
|
context as context, # a func-decorator
|
2023-04-14 20:23:47 +00:00
|
|
|
)
|
|
|
|
|
from ._streaming import (
|
2024-01-02 15:25:17 +00:00
|
|
|
MsgStream as MsgStream,
|
|
|
|
|
stream as stream,
|
2021-05-12 03:41:26 +00:00
|
|
|
)
|
2026-04-14 16:27:04 +00:00
|
|
|
from .discovery._api import (
|
2024-07-04 23:40:11 +00:00
|
|
|
get_registry as get_registry,
|
2024-01-02 15:25:17 +00:00
|
|
|
find_actor as find_actor,
|
|
|
|
|
wait_for_actor as wait_for_actor,
|
|
|
|
|
query_actor as query_actor,
|
|
|
|
|
)
|
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
2026-03-23 22:42:16 +00:00
|
|
|
from .runtime._supervise import (
|
2024-01-02 15:25:17 +00:00
|
|
|
open_nursery as open_nursery,
|
|
|
|
|
ActorNursery as ActorNursery,
|
2022-03-07 21:21:52 +00:00
|
|
|
)
|
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
2026-03-23 22:42:16 +00:00
|
|
|
from .runtime._state import (
|
2026-03-23 17:33:39 +00:00
|
|
|
RuntimeVars as RuntimeVars,
|
2024-01-02 15:25:17 +00:00
|
|
|
current_actor as current_actor,
|
2024-05-20 19:47:01 +00:00
|
|
|
current_ipc_ctx as current_ipc_ctx,
|
2026-03-23 17:33:39 +00:00
|
|
|
debug_mode as debug_mode,
|
|
|
|
|
get_runtime_vars as get_runtime_vars,
|
|
|
|
|
is_root_process as is_root_process,
|
2022-09-15 20:15:17 +00:00
|
|
|
)
|
2021-06-13 22:02:27 +00:00
|
|
|
from ._exceptions import (
|
2024-01-02 15:25:17 +00:00
|
|
|
ContextCancelled as ContextCancelled,
|
2024-04-05 20:32:15 +00:00
|
|
|
ModuleNotExposed as ModuleNotExposed,
|
|
|
|
|
MsgTypeError as MsgTypeError,
|
|
|
|
|
RemoteActorError as RemoteActorError,
|
2024-07-02 16:21:26 +00:00
|
|
|
TransportClosed as TransportClosed,
|
2021-06-13 22:02:27 +00:00
|
|
|
)
|
2023-09-28 18:14:50 +00:00
|
|
|
from .devx import (
|
2024-01-02 15:25:17 +00:00
|
|
|
breakpoint as breakpoint,
|
|
|
|
|
pause as pause,
|
|
|
|
|
pause_from_sync as pause_from_sync,
|
|
|
|
|
post_mortem as post_mortem,
|
2023-04-15 23:48:52 +00:00
|
|
|
)
|
2024-01-02 15:25:17 +00:00
|
|
|
from . import msg as msg
|
2022-09-15 20:15:17 +00:00
|
|
|
from ._root import (
|
2024-01-02 15:25:17 +00:00
|
|
|
run_daemon as run_daemon,
|
|
|
|
|
open_root_actor as open_root_actor,
|
2022-09-15 20:15:17 +00:00
|
|
|
)
|
2025-03-13 23:41:30 +00:00
|
|
|
from .ipc import Channel as Channel
|
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
2026-03-23 22:42:16 +00:00
|
|
|
from .runtime._portal import Portal as Portal
|
|
|
|
|
from .runtime._runtime import Actor as Actor
|
Rename `Arbiter` -> `Registrar`, mv to `discovery._registry`
Move the `Arbiter` class out of `runtime._runtime` into its
logical home at `discovery._registry` as `Registrar(Actor)`.
This completes the long-standing terminology migration from
"arbiter" to "registrar/registry" throughout the codebase.
Deats,
- add new `discovery/_registry.py` mod with `Registrar`
class + backward-compat `Arbiter = Registrar` alias.
- rename `Actor.is_arbiter` attr -> `.is_registrar`;
old attr now a `@property` with `DeprecationWarning`.
- `_root.py` imports `Registrar` directly for
root-actor instantiation.
- export `Registrar` + `Arbiter` from `tractor.__init__`.
- `_runtime.py` re-imports from `discovery._registry`
for backward compat.
Also,
- update all test files to use `.is_registrar`
(`test_local`, `test_rpc`, `test_spawning`,
`test_discovery`, `test_multi_program`).
- update "arbiter" -> "registrar" in comments/docstrings
across `_discovery.py`, `_server.py`, `_transport.py`,
`_testing/pytest.py`, and examples.
- drop resolved TODOs from `_runtime.py` and `_root.py`.
(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-03-23 22:56:21 +00:00
|
|
|
from .discovery._registry import (
|
|
|
|
|
Registrar as Registrar,
|
|
|
|
|
Arbiter as Arbiter,
|
|
|
|
|
)
|
2025-03-16 21:20:20 +00:00
|
|
|
# from . import hilevel as hilevel
|