tractor/tractor
Tyler Goodlet 6690968236 Rework and first draft of `.devx._frame_stack.py`
Proto-ing a little suite of call-stack-frame annotation-for-scanning
sub-systems for the purposes of both,
- the `.devx._debug`er and its
  traceback and frame introspection needs when entering the REPL,
- detailed trace-style logging such that we can explicitly report
  on "which and where" `tractor`'s APIs are used in the "app" code.

Deats:
- change mod name obvi from `._code` and adjust client mod imports.
- using `wrapt` (for perf) implement a `@api_frame` annot decorator
  which both stashes per-call-stack-frame instances of `CallerInfo` in
  a table and marks the function such that API endpoints can be easily
  found via runtime stack scanning despite any internal impl changes.
- add a global `_frame2callerinfo_cache: dict[FrameType, CallerInfo]`
  table for providing the per func-frame info caching.
- Re-implement `CallerInfo` to require less (types of) inputs:
  |_ `_api_func: Callable`, a ref to the (singleton) func def.
  |_ `_api_frame: FrameType` taken from the `@api_frame` marked `tractor`-API
     func's runtime call-stack, from which we can determine the
     app code's `.caller_frame`.
  |_`_caller_frames_up: int|None` allowing the specific `@api_frame` to
    determine "how many frames up" the application / calling code is.
  And, a better set of derived attrs:
  |_`caller_frame: FrameType` which finds and caches the API-eps calling
    frame.
  |_`caller_frame: FrameType` which finds and caches the API-eps calling
- add a new attempt at "getting a method ref from its runtime frame"
  with `get_ns_and_func_from_frame()` using a heuristic that the
  `CodeType.co_qualname: str` should have a "." in it for methods.
  - main issue is still that the func-ref lookup will require searching
    for the method's instance type by name, and that name isn't
    guaranteed to be defined in any particular ns..
   |_rn we try to read it from the `FrameType.f_locals` but that is
     going to obvi fail any time the method is called in a module where
     it's type is not also defined/imported.
  - returns both the ns and the func ref FYI.
2024-05-08 14:51:56 -04:00
..
_testing Start a new `._testing.fault_simulation` 2024-04-03 10:19:50 -04:00
devx Rework and first draft of `.devx._frame_stack.py` 2024-05-08 14:51:56 -04:00
experimental Drop now-deprecated deps on modern `trio`/Python 2024-03-13 18:41:24 -04:00
msg Allow `Stop` passthrough from `PldRx.recv_msg_w_pld()` 2024-05-08 08:50:16 -04:00
trionics Drop now-deprecated deps on modern `trio`/Python 2024-03-13 18:41:24 -04:00
__init__.py Expose `MsgTypeError` from pkg 2024-04-05 16:32:15 -04:00
_child.py Hide `._entry`/`._child` frames, tweak some more type annots 2024-04-14 17:49:18 -04:00
_clustering.py Passthrough runtime kwargs from `open_actor_cluster()` 2022-12-11 19:56:08 -05:00
_context.py Rework and first draft of `.devx._frame_stack.py` 2024-05-08 14:51:56 -04:00
_discovery.py More spaceless union type annots 2024-03-11 10:33:06 -04:00
_entry.py "Icons" in `._entry`'s subactor `.info()` messages 2024-05-06 13:12:44 -04:00
_exceptions.py Change to `RemoteActorError.pformat()` 2024-05-06 13:01:56 -04:00
_forkserver_override.py Re-license code base for distribution under AGPL 2021-12-14 23:33:27 -05:00
_ipc.py Move `MsgTypeError` maker func to `._exceptions` 2024-04-22 18:24:02 -04:00
_mp_fixup_main.py Avoid importing mp for as long as possible 2022-02-17 11:55:26 -05:00
_multiaddr.py Fix doc string "its" typo.. 2023-11-06 15:44:21 -05:00
_portal.py Change to `RemoteActorError.pformat()` 2024-05-06 13:01:56 -04:00
_root.py Tweak `breakpoint()` usage error message 2024-04-30 12:56:29 -04:00
_rpc.py Add a "current IPC `Context`" `ContextVar` 2024-05-07 15:35:45 -04:00
_runtime.py Mk `process_messages()` return last msg; summary logging 2024-04-30 12:15:46 -04:00
_shm.py Drop now-deprecated deps on modern `trio`/Python 2024-03-13 18:41:24 -04:00
_spawn.py Type annot the proc from `trio.lowlevel.open_process()` 2024-04-30 12:59:38 -04:00
_state.py Add a "current IPC `Context`" `ContextVar` 2024-05-07 15:35:45 -04:00
_streaming.py More bitty (runtime) logging tweaks 2024-04-26 13:13:04 -04:00
_supervise.py Annotate nursery and portal methods for `CallerInfo` scanning 2024-04-18 15:17:50 -04:00
log.py Add a `.log.at_least_level()` predicate 2024-05-08 13:33:59 -04:00
to_asyncio.py Provision for infected-`asyncio` debug mode support 2024-03-25 16:09:32 -04:00