Skip to content

Add repl weave filter and jupyter extra - #105

Merged
jhidding merged 1 commit into
mainfrom
feature/weave-repl
Nov 15, 2026
Merged

jhidding merged 1 commit into
mainfrom
feature/weave-repl

Conversation

@jhidding

Copy link
Copy Markdown
Contributor

Summary

  • jupyter extra: pip install entangled-cli[jupyter] installs repl-session[jupyter]. The base dependency is now repl-session>=0.3.0.
  • repl hook: each language in [hook.repl.config] can now use the Jupyter backend (backend = "jupyter", kernel = "python3"). Configs without a backend default to the pexpect REPL, so existing entangled.toml files keep working.
  • entangled weave -f repl: inserts results from <session>.out.json (e.g. repl-session < s.json > s.out.json) after each code block with the repl class.
    • Text output goes in a {.text .output} code block, with an extra .stdout, .stderr or .error class for those kinds.
    • For rich output it picks Markdown first, then HTML, then SVG, then PNG/JPEG/GIF (embedded as data URIs), then plain text. A mime-type attribute on the code block overrides that order.
    • It still reads output files from repl-session < 0.3, which only have the single output field.
    • If the session output is missing or unreadable, or a block's code doesn't match the stored command, it logs a warning and leaves the block unchanged.
    • It works together with -f label: the output goes inside the label <div>.
  • Docs: README, man page source and the regenerated man/entangled.1.

Tests

  • Unit tests for the filter use hand-written session output. They cover rendering, the mime-type override, old-style output files, and missing or out-of-date sessions.
  • An end-to-end test tangles a document, runs the session in a real python3 Jupyter kernel and weaves the result. ipykernel is added as a dev dependency so this runs in CI.

🤖 Generated with Claude Code

- `entangled-cli[jupyter]` forwards to `repl-session[jupyter]`.
- The `repl` hook accepts Jupyter backend configs; configs without a
  `backend` default to the pexpect REPL.
- `entangled weave -f repl` inserts results from `<session>.out.json`
  after code blocks with the `repl` class, rendering text, Markdown,
  HTML and images. Stale or missing session output gives a warning.
- ipykernel as dev dependency, to test the Jupyter backend end-to-end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jhidding
jhidding merged commit f91f55d into main Nov 15, 2026
9 checks passed
@jhidding
jhidding deleted the feature/weave-repl branch November 15, 2026 20:01
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