shm_from_tractor: port to the tractor.ipc. API #89

Merged
goodboy merged 3 commits from shm_from_tractor into main 2026-03-18 01:14:57 +00:00

I’ve put it off for far too long without good reason and claude was able to do the port on the first try 🏄

Works toward fully solving #83 with #91 being a follow up to truly ensure it’s all rock solid (though pretty sure we’re gud after much manual testing).

I've put it off for far too long without good reason and `claude` was able to do the port on the first try 🏄 Works toward fully solving #83 with #91 being a follow up to truly ensure it's all rock solid (though pretty sure we're gud after much manual testing).
goodboy added 2 commits 2026-03-17 18:08:05 +00:00
14e4eb495e Port `_sharedmem` to thin shim over `tractor.ipc._shm`
Replace the ~716 line `piker.data._sharedmem` mod with a thin re-export
shim consuming `tractor.ipc._shm` types directly, since the `tractor`
version is the refined factoring of piker's original impl.

Deats,
- Re-export `SharedInt`, `ShmArray`, `ShmList`, `get_shm_token`,
  `_known_tokens` directly
- Alias renames: `NDToken as _Token`, `open_shm_ndarray as
  open_shm_array`, `attach_shm_ndarray as attach_shm_array`
- Keep `_make_token()` wrapper for piker's default dtype fallback to
  `def_iohlcv_fields`
- Keep `maybe_open_shm_array()` wrapper preserving piker's historical
  defaults (`readonly=False`, `append_start_index=None`)
- Keep `try_read()` race-condition guard (not in `tractor`)

All 13 import sites across piker continue to work unchanged with no
modifications needed.

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
fa4130aeae Use `tractor.ipc._shm` types directly across codebase
Port all 16 internal import sites from re-exporting
via `piker.data._sharedmem` shim to importing core
shm types directly from `tractor.ipc._shm`.

Deats,
- `ShmArray` now imported from tractor in 10 files.
- `_Token` renamed to `NDToken` everywhere (5 files).
- `attach_shm_array` → `attach_shm_ndarray` at all
  call sites.
- `data/__init__.py` sources `ShmArray`,
  `get_shm_token` from tractor; keeps
  `open/attach_shm_array` as public API aliases.
- Trim shim to only piker-specific wrappers:
  `_make_token()`, `maybe_open_shm_array()`,
  `try_read()`.
- Drop `Optional` usage in shim, use `|None`.

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
guille approved these changes 2026-03-17 21:38:36 +00:00
goodboy force-pushed shm_from_tractor from fa4130aeae to 0a2059d00f 2026-03-17 22:00:37 +00:00 Compare
goodboy requested review from guille 2026-03-17 22:05:14 +00:00
goodboy removed review request for guille 2026-03-17 22:05:52 +00:00
goodboy added 1 commit 2026-03-17 22:13:22 +00:00
goodboy merged commit 1abd47609b into main 2026-03-18 01:14:57 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pikers/piker#89
There is no content yet.