Add showboat var for persistent variables across cells#11
Closed
simonw wants to merge 5 commits into
Closed
Conversation
Cells executed via `showboat exec` can now set and read persistent variables using `showboat var set/get/list/del`. Variables are stored in a <file>.vars JSON file alongside the markdown document. The runner copies the showboat binary into a temp directory on PATH and sets SHOWBOAT_VARS in the child environment, so cells can call `showboat var` regardless of how the parent was invoked (go run, uvx, system PATH, etc.). Works cross-platform (Windows .exe handling). During `verify`, the vars file is cleared at the start for deterministic replay and cleaned up afterward. https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz
Comprehensive demo showing: basic set/get, starting a background http.server and saving its PID, fetching from the server, stopping it with the saved PID, listing and deleting variables, and cross-language usage from Python. Passes showboat verify. https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz
showboatDir() now checks if the directory containing os.Executable() already has a "showboat" entry (the common case for go install, system PATH, etc.) and uses it directly — zero I/O, no temp dir, no cleanup. Only when the binary lives elsewhere (uvx Python shim, go run, renamed binary) does it fall back to creating a temp dir with a symlink. Copy is a last resort for Windows without symlink privileges. Both paths are covered by unit tests: TestShowboatDirFastPath and TestShowboatDirSymlinkFallback. https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz
Injects a failing symlinkFunc to force showboatDirFrom through the copy path on Linux (where symlinks normally always succeed). Verifies the copied file has correct content and executable permissions. https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz
Owner
Author
|
I'm not convinced my this feature - it adds a lot of complexity. I've decided to go with a feature that's specially for starting servers so they can be shut down later instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cells executed via
showboat execcan now set and read persistentvariables using
showboat var set/get/list/del. Variables are storedin a .vars JSON file alongside the markdown document.
The runner copies the showboat binary into a temp directory on PATH
and sets SHOWBOAT_VARS in the child environment, so cells can call
showboat varregardless of how the parent was invoked (go run, uvx,system PATH, etc.). Works cross-platform (Windows .exe handling).
During
verify, the vars file is cleared at the start for deterministicreplay and cleaned up afterward.
https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz