Skip to content

feat(cli): add keecas edit --sandbox for notebooks with inline dependencies - #137

Merged
kompre merged 4 commits into
mainfrom
ccr-08331460-708lgj
Oct 14, 2026
Merged

kompre merged 4 commits into
mainfrom
ccr-08331460-708lgj

Conversation

@kompre

@kompre kompre commented Oct 14, 2026

Copy link
Copy Markdown
Owner

A notebook declares extra packages in a PEP 723 '# /// script' block in a
comment-only code cell. 'keecas edit --sandbox' parses it and relaunches
itself through 'uv run --isolated --no-project' with keecas plus those
dependencies, so the Jupyter server and kernel can import them. Without the
flag, a notebook that declares dependencies prompts for sandbox mode
(interactive terminals with uv only); --no-sandbox skips the prompt.

uv stays optional: --sandbox fails with an install hint when it is missing.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01HqdUYGn85WvQvuEjFX6ADn

claude and others added 4 commits October 14, 2026 19:36
…encies

A notebook declares extra packages in a PEP 723 '# /// script' block in a
comment-only code cell. 'keecas edit --sandbox' parses it and relaunches
itself through 'uv run --isolated --no-project' with keecas plus those
dependencies, so the Jupyter server and kernel can import them. Without the
flag, a notebook that declares dependencies prompts for sandbox mode
(interactive terminals with uv only); --no-sandbox skips the prompt.

uv stays optional: --sandbox fails with an install hint when it is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqdUYGn85WvQvuEjFX6ADn
Jupyter resolves kernels by name through its kernel directories, so a
user-registered python3 kernel (with JUPYTER_PREFER_ENV_PATH=0) or a
notebook naming another registered environment would run the notebook
outside the sandbox, without its declared dependencies.

Inside the sandbox, keecas edit now writes a temporary python3 kernelspec
for sys.executable, puts it first on JUPYTER_PATH, and starts the server
with KernelSpecManager.allowed_kernelspecs=python3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqdUYGn85WvQvuEjFX6ADn
@kompre
kompre enabled auto-merge October 14, 2026 20:00
@kompre
kompre merged commit 22561d1 into main Oct 14, 2026
3 checks passed
@kompre
kompre deleted the ccr-08331460-708lgj branch October 14, 2026 20:10
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