Skip to content

Add shared R and Python Jupyter execution through reticulate - #179

Draft
t-kalinowski wants to merge 4 commits into
feat/jupyter-kernelsfrom
feat/jupyter-reticulate
Draft

t-kalinowski wants to merge 4 commits into
feat/jupyter-kernelsfrom
feat/jupyter-reticulate

Conversation

@t-kalinowski

@t-kalinowski t-kalinowski commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Adds R and Python execution in the same ark process, building on the local Jupyter worker in #178. This draft targets feat/jupyter-kernels, so its diff contains the reticulate integration rather than repeating the underlying kernel support.

  • --jupyter-reticulate exposes r and python alongside native code. Python runs through published reticulate, with shared objects and R/Python callbacks.
  • The additional experimental --jupyter-reticulate-ipykernel flag starts an ipykernel endpoint inside the R process. It supplies Python expression results, rich displays, Matplotlib output, tracebacks, prompted input, and top-level await while preserving the shared namespace.
  • The Python transport loop runs on a background thread; submitted code runs on R's owning thread through a paired reticulate call. Both endpoints must complete before another cell starts, and loss of either endpoint retires the shared worker. The default private sandbox transports also cover this mode without opening host networking.
  • Adds shared-state, callback, output, input, interruption, restart, and process-retirement cases, plus matched R/Python startup, dispatch, memory, and distribution measurements on macOS and Linux.

This uses published ark, ipykernel, and reticulate without modifying their repositories or requiring Positron. The shared endpoint remains experimental: its asyncio loop advances only during Python cells, native blocking calls can delay interruption, both languages share one failure domain, and native descriptor output can interleave. The guide documents these limits, ipykernel compatibility hooks, missing built-in features, and installation costs. The benchmarks show higher dispatch and memory costs than the built-in worker for the measured trivial cells; their original provenance is retained.

Local feature validation passed 15 focused public cases (16 executions) on macOS, including shared reticulate/ipykernel execution, the macOS sandbox, CLI validation, and the replacement-startup regression. These checks used ark 0.1.252, ipykernel 7.4.0, and published reticulate 1.47.0. scripts/format and scripts/check passed. The inherited Jupyter documentation repair passed all 36 website checks on the base branch. Native Windows and a fresh Linux run were not validated locally for this update. The original benchmark files retain their original revisions and platform provenance.

The hosted Unix runners capability-skip the optional Jupyter execution cases when kernel dependencies are not configured; those runs do not establish kernel execution coverage. The Windows runner reports MXC unavailable, so native sandbox execution remains unverified. Documentation deployment is intentionally skipped for pull requests.

The inherited transcript collectors preserve exact completion markers for combined control and source calls, including code, across split responses. The reticulate feature diff against #178 is unchanged. For this collector update, the native R startup gate and plain ipykernel interrupt/restart case passed on macOS. The shared ipykernel interrupt/restart and simple reticulate process/state cases passed with published ipykernel 7.4.0 and CRAN reticulate 1.47.0 (four distinct cases in total). scripts/format, git diff --check, and scripts/check passed. Current-head hosted checks remain pending; Linux and Windows were not rerun locally for this repair.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant