Skip to content

1.10.0: one subpackage per provider, and the Marimo kernel helper is real code - #39

Merged
echarles merged 6 commits into
mainfrom
refactor/sandboxes-subpackages
Sep 27, 2026
Merged

echarles merged 6 commits into
mainfrom
refactor/sandboxes-subpackages

Conversation

@echarles

@echarles echarles commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

What

  • One subpackage per provider. Every sandbox lives under code_sandboxes.sandboxes.<provider>: the implementation in <provider>/<provider>.py, re-exported by the package's __init__, with the modules only that provider needs beside it (Kaggle: client, execute, live; Marimo: cells, reactive, reactive_kernel; Google Colab: client). Public imports from code_sandboxes are unchanged.
  • Breaking, no backwards compatibility: the 1.9.x flat module paths (code_sandboxes.datalayer_sandbox, code_sandboxes.kaggle, …) are removed, not aliased. Consumers move to code_sandboxes or the new paths (jupyter-mcp-sandboxes 0.2.7, agent-runtimes, services follow this release).
  • The Marimo kernel helper is real code. sandboxes/marimo/reactive_kernel.py is a typed, self-contained module; reactive.KERNEL_HELPER_SOURCE is that file's own text, read from the installed package. mypy now checks what the kernel runs, and tests/test_marimo_reactive_kernel.py (14 tests) covers replacement, conflicts, cycles, plans, removal, re-execution keeping the graph, and the wire encoding.
  • Docs: provider pages import from the subpackages; the Marimo page describes the real-code helper and points at the hosted marimo toolset.
  • Version 1.10.0, changelog entry.

Checked locally

  • ruff clean; mypy: no issues in 83 source files.
  • The marimo, alias and moved-provider tests pass; the full suite runs in a small venv matching CI.

…real code

Every sandbox moved under code_sandboxes.sandboxes.<provider>: the
implementation in <provider>/<provider>.py, re-exported by the package's
__init__, and the modules only it needs beside it (Kaggle's client,
execute and live; Marimo's cells, reactive and reactive_kernel; Google
Colab's client). The public names are unchanged. The 1.9.x flat paths
(code_sandboxes.datalayer_sandbox, ...) stay as aliases of the very same
module objects, since released consumers import them; deprecated, gone in
2.0.

The Marimo kernel helper was a string constant no tool could check. It is
reactive_kernel.py now: a typed, self-contained module whose own file text
is what the kernel receives, so mypy and the tests read exactly what the
kernel runs. A new suite covers replacement, conflicts, cycles, plans,
removal, re-execution keeping the graph, and the wire encoding.

Docs follow the new paths; the Marimo page describes the real-code helper
and points at the hosted marimo toolset.
Copilot AI lite review requested due to automatic review settings September 27, 2026 07:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical relocation-related test failures and a Marimo installability issue remain unresolved.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity

Open (3)
What changed in this PR

This PR reorganizes providers into dedicated subpackages, preserves legacy imports, and adds a typed, source-backed Marimo kernel helper.

Changes:

  • Moves provider implementations and updates imports, tests, and documentation.
  • Adds legacy flat-module aliases and compatibility coverage.
  • Adds Marimo helper code and tests, with version 1.10.0 metadata.
File Summary
tests/​test_modal_session.py Updates Modal imports; source lookup still targets a removed path, causing a critical failure.
tests/​test_modal_google_colab_sandbox.py Updates provider imports and patches.
tests/​test_marimo_sandbox.py Updates Marimo imports.
tests/​test_marimo_reactive_kernel.py Tests the source-backed reactive helper.
tests/​test_marimo_cells.py Updates Marimo cells imports.
tests/​test_manage_datalayer.py Updates Datalayer imports.
tests/​test_lifecycle_vocabulary.py Updates lifecycle imports.
tests/​test_kernel_client_compatibility.py Updates Kaggle compatibility imports.
tests/​test_kaggle.py Updates Kaggle client imports and patches.
tests/​test_kaggle_session.py Updates Kaggle sandbox imports.
tests/​test_kaggle_live.py Updates live-session imports.
tests/​test_kaggle_execute.py Updates executor imports.
tests/​test_jupyter_server.py Updates Jupyter Server imports and patches.
tests/​test_jupyter_server_streaming.py Updates streaming imports.
tests/​test_jupyter_ingress.py Updates provider imports.
tests/​test_integration.py Updates Eval imports.
tests/​test_google_colab.py Updates Colab imports and patches.
tests/​test_flat_paths_are_aliases.py Tests legacy aliases; several advertised mappings remain uncovered.
tests/​test_factory.py Updates factory provider imports.
tests/​test_eval.py Updates Eval imports.
tests/​test_environment_modal_builder.py Updates Modal patches.
tests/​test_environment_daytona_builder.py Updates Daytona patches.
tests/​test_environment_conformance.py Updates Eval imports.
tests/​test_e2b.py Updates E2B imports.
tests/​test_daytona.py Updates Daytona imports.
tests/​test_datalayer_sandbox.py Updates Datalayer imports.
tests/​test_coreweave.py Updates CoreWeave imports.
tests/​test_contents_contract.py Updates provider imports.
tests/​test_cloudflare.py Updates Cloudflare imports.
tests/​test_client_files.py Updates Eval imports.
tests/​test_client_contents.py Updates Eval imports.
tests/​test_cli_exec.py Updates Eval imports and patches.
tests/​test_a_datalayer_sandbox_can_be_interrupted.py Updates sandbox imports.
tests/​conftest.py Updates Eval fixture imports.
pyproject.toml Updates lint configuration.
docs/​docs/​providers/​monty.mdx Updates Monty documentation imports.
docs/​docs/​providers/​marimo.mdx Documents the new Marimo helper and paths.
docs/​docs/​providers/​jupyter-server.mdx Updates Jupyter Server documentation.
docs/​docs/​providers/​index.mdx Documents provider subpackages; contributor guidance remains inconsistent.
docs/​docs/​providers/​eval.mdx Updates Eval documentation.
docs/​docs/​providers/​docker.mdx Updates Docker documentation.
docs/​docs/​providers/​datalayer.mdx Updates Datalayer documentation.
code_sandboxes/​sandboxes/​monty/​monty.py Relocates Monty implementation.
code_sandboxes/​sandboxes/​monty/​__init__.py Re-exports Monty symbols.
code_sandboxes/​sandboxes/​modal/​modal.py Relocates Modal implementation.
code_sandboxes/​sandboxes/​modal/​__init__.py Re-exports Modal symbols.
code_sandboxes/​sandboxes/​marimo/​reactive.py Loads helper source from the installed package.
code_sandboxes/​sandboxes/​marimo/​reactive_kernel.py Adds typed kernel helper; eager Marimo import conflicts with documented standalone execution.
code_sandboxes/​sandboxes/​marimo/​marimo.py Relocates Marimo implementation.
code_sandboxes/​sandboxes/​marimo/​cells.py Updates reactive imports.
code_sandboxes/​sandboxes/​marimo/​__init__.py Re-exports Marimo symbols.
code_sandboxes/​sandboxes/​kaggle/​live.py Relocates Kaggle live session.
code_sandboxes/​sandboxes/​kaggle/​kaggle.py Relocates Kaggle sandbox.
code_sandboxes/​sandboxes/​kaggle/​execute.py Relocates Kaggle executor.
code_sandboxes/​sandboxes/​kaggle/​client.py Relocates Kaggle client.
code_sandboxes/​sandboxes/​kaggle/​__init__.py Re-exports Kaggle symbols.
code_sandboxes/​sandboxes/​jupyter_server/​jupyter_server.py Relocates Jupyter Server implementation.
code_sandboxes/​sandboxes/​jupyter_server/​__init__.py Re-exports Jupyter Server symbols.
code_sandboxes/​sandboxes/​google_colab/​google_colab.py Relocates Colab implementation.
code_sandboxes/​sandboxes/​google_colab/​client.py Relocates Colab client.
code_sandboxes/​sandboxes/​google_colab/​__init__.py Re-exports Colab symbols.
code_sandboxes/​sandboxes/​eval/​eval.py Relocates Eval implementation.
code_sandboxes/​sandboxes/​eval/​__init__.py Re-exports Eval symbols.
code_sandboxes/​sandboxes/​e2b/​e2b.py Relocates E2B implementation.
code_sandboxes/​sandboxes/​e2b/​__init__.py Re-exports E2B symbols.
code_sandboxes/​sandboxes/​docker/​docker.py Relocates Docker implementation.
code_sandboxes/​sandboxes/​docker/​__init__.py Re-exports Docker symbols.
code_sandboxes/​sandboxes/​daytona/​daytona.py Relocates Daytona implementation.
code_sandboxes/​sandboxes/​daytona/​__init__.py Re-exports Daytona symbols.
code_sandboxes/​sandboxes/​datalayer/​datalayer.py Relocates Datalayer implementation.
code_sandboxes/​sandboxes/​datalayer/​__init__.py Re-exports Datalayer symbols.
code_sandboxes/​sandboxes/​coreweave/​coreweave.py Relocates CoreWeave implementation.
code_sandboxes/​sandboxes/​coreweave/​__init__.py Re-exports CoreWeave symbols.
code_sandboxes/​sandboxes/​cloudflare/​cloudflare.py Relocates Cloudflare implementation.
code_sandboxes/​sandboxes/​cloudflare/​__init__.py Re-exports Cloudflare symbols.
code_sandboxes/​sandboxes/​__init__.py Defines the provider package layout.
code_sandboxes/​provider_ingress.py Updates Jupyter Server imports.
code_sandboxes/​manage.py Updates provider manager imports.
code_sandboxes/​environments/​adapters/​modal.py Updates Modal references.
code_sandboxes/​base.py Updates factory and environment imports.
code_sandboxes/​__version__.py Sets version 1.10.0.
code_sandboxes/​__init__.py Re-exports providers and installs aliases; existing variant discovery misses relocated classes and fails critically.
CHANGELOG.md Documents the 1.10.0 release.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread code_sandboxes/__init__.py Outdated
Comment on lines +329 to +333
# 1.10.0 moved every provider into `code_sandboxes.sandboxes.<provider>`.
# Released consumers import the old paths — `code_sandboxes.datalayer_sandbox`
# in jupyter-mcp-sandboxes 0.2.6, which the MCP gateway image installs from
# PyPI — and a fresh install would break them until each is re-released. So
# each old dotted path names the *same module object* as its new home:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fa6c67a: variants() now walks the provider packages under code_sandboxes.sandboxes and imports each <provider>/<provider>.py, so the sweep finds the variants again. Two builder adapters (Daytona, Modal) still imported the flat paths with relative imports, which the same commit points at the provider packages.


from code_sandboxes.modal_sandbox import ModalSandbox
from code_sandboxes.models import SandboxConfig
from code_sandboxes.sandboxes.modal import ModalSandbox

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fa6c67a: _driver_source() reads code_sandboxes/sandboxes/modal/modal.py.

Comment thread tests/test_flat_paths_are_aliases.py Outdated
("marimo_reactive", "sandboxes.marimo.reactive"),
("marimo_sandbox", "sandboxes.marimo.marimo"),
("modal_sandbox", "sandboxes.modal.modal"),
]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f990f4b: PAIRS now lists all nineteen flat paths, written out rather than read from the package, and a new test asserts the package's alias table (_FLAT_PATHS, now a module constant) equals it, so a dropped or mistyped entry fails either way.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded in 67eab4e: the flat-path aliases are removed altogether (no backwards compatibility), so the alias table and its test are gone. The 1.9.x paths now fail to import, and the changelog marks the move as breaking.

…r packages, and three tests read the new layout

The Daytona and Modal builder adapters still imported the flat paths with
three-dot relative imports, which resolved through the aliases to the
implementation modules, so tests patching the provider package no longer
reached them. The interrupt sweep scans code_sandboxes.sandboxes' packages,
the manage test patches the package manage takes the class from, and the
Modal session test reads modal/modal.py.
…teen flat paths explicitly and holds the table to them
…not aliased

The alias table and its test are gone; the changelog marks the move as
breaking. The interrupt tests, which had passed only through the aliases,
import each variant from its provider package.
@echarles
echarles merged commit d9c3992 into main Sep 27, 2026
8 checks passed
@echarles
echarles deleted the refactor/sandboxes-subpackages branch September 27, 2026 08:38
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.

2 participants