script-widget 0.1.19__tar.gz → 0.1.21__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- script_widget-0.1.21/CHANGELOG.md +6 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/CLAUDE.md +44 -3
- {script_widget-0.1.19/src/script_widget.egg-info → script_widget-0.1.21}/PKG-INFO +1 -1
- script_widget-0.1.21/docs/pages/example.ipynb +739 -0
- script_widget-0.1.21/docs/pages/overview.ipynb +401 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/pyproject.toml +1 -1
- {script_widget-0.1.19 → script_widget-0.1.21}/src/script_widget/executor.py +7 -2
- {script_widget-0.1.19 → script_widget-0.1.21}/src/script_widget/widget.py +146 -41
- {script_widget-0.1.19 → script_widget-0.1.21/src/script_widget.egg-info}/PKG-INFO +1 -1
- script_widget-0.1.19/CHANGELOG.md +0 -0
- script_widget-0.1.19/docs/pages/example.ipynb +0 -5104
- script_widget-0.1.19/docs/pages/overview.ipynb +0 -85
- {script_widget-0.1.19 → script_widget-0.1.21}/.claude/agents/code-api-consistency-reviewer.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.claude/agents/code-frontend-reviewer.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.claude/agents/code-python-reviewer.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.claude/agents/code-theming-reviewer.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.claude/agents/code-ui-heuristics-reviewer.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.claude/commands/review-apply.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.claude/commands/review-init.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.claude/commands/review.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/Dockerfile +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/README.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/devcontainer.json +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/init-firewall.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/mcp-setup/generate-config.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/mcp-setup/install.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/mcp-setup/pixi.toml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/mcp-setup/servers.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.devcontainer/mcp-setup/test-servers.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.gitattributes +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.github/workflows/conda-release.yml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.github/workflows/pypi-release.yml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.github/workflows/quarto-publish.yml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.gitignore +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/.vscode/vscode.css +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/LICENSE +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/README.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/conda-build/README.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/conda-build/build_env.yaml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/conda-build/meta.yaml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/data/data_table.csv +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/.gitignore +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/README.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/_extensions/machow/interlinks/.gitignore +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/_extensions/machow/interlinks/_extension.yml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/_extensions/machow/interlinks/interlinks.lua +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/_inv/griffe_objects.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/_inv/numpy_objects.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/_inv/python_objects.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/_quarto.yml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/api/ExerciseOutputWidget.qmd +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/api/ExerciseResult.qmd +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/api/_sidebar.yml +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/api/_styles-quartodoc.css +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/api/index.qmd +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/api/register_exercise_magic.qmd +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/api/run_exercise.qmd +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/autodoc.mustache +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/custom.scss +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/objects.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/docs/styles.css +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/pixi.lock +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/review-kit/README.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/review-kit/TEMPLATE_AUTHORS.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/review-kit/USAGE.md +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/scripts/bump_version.py +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/scripts/docs-build-render.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/scripts/docs-run-notebooks.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/scripts/git-commit.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/scripts/github-release.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/scripts/rename.py +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/scripts/tmux-project.sh +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/setup.cfg +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/src/script_widget/__init__.py +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/src/script_widget.egg-info/SOURCES.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/src/script_widget.egg-info/dependency_links.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/src/script_widget.egg-info/requires.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/src/script_widget.egg-info/top_level.txt +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/test/conftest.py +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/test/test_executor.py +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/test/test_frontend.py +0 -0
- {script_widget-0.1.19 → script_widget-0.1.21}/test/test_widget.py +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
## [v0.1.19] - 2026-07-20
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
- [`81d59dc`](https://github.com/munch-group/script-widget/commit/81d59dc5a032272d97617688453bf67151d64c47) - pin conda recipe python to requires-python range *(commit by [@kaspermunch](https://github.com/kaspermunch))*
|
|
5
|
+
|
|
6
|
+
[v0.1.19]: https://github.com/munch-group/script-widget/compare/v0.1.18...v0.1.19
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# CLAUDE.md
|
|
2
2
|
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working
|
|
4
|
+
with code in this repository.
|
|
5
|
+
|
|
3
6
|
Project context for `script-widget` -- a Jupyter cell magic that runs a cell
|
|
4
7
|
in a fresh, isolated namespace, built on
|
|
5
8
|
[anywidget](https://anywidget.dev).
|
|
@@ -52,7 +55,11 @@ The package is `script_widget` under `src/`:
|
|
|
52
55
|
and the trailing value (if any) is reported as a `text/plain` output.
|
|
53
56
|
Returns an `ExerciseResult(stdout, stderr, outputs, error, traceback)` --
|
|
54
57
|
never raises; a `SyntaxError` or any runtime exception is caught and
|
|
55
|
-
reported via `.error`/`.traceback`.
|
|
58
|
+
reported via `.error`/`.traceback`. With a live `ip`, `.traceback` comes
|
|
59
|
+
from `ip.InteractiveTB.structured_traceback()`/`.stb2text()` (the same
|
|
60
|
+
machinery IPython itself uses to print an uncaught exception), so it
|
|
61
|
+
carries the same ANSI color codes a normal notebook traceback would --
|
|
62
|
+
see "Colored tracebacks" under Architecture.
|
|
56
63
|
- `src/script_widget/widget.py` -- `ExerciseOutputWidget` (the
|
|
57
64
|
`anywidget.AnyWidget`) + the embedded `_ESM`/`_CSS` frontend strings +
|
|
58
65
|
`register_exercise_magic()`. The widget's traits are copied from an
|
|
@@ -61,7 +68,10 @@ The package is `script_widget` under `src/`:
|
|
|
61
68
|
frontend's `render()` draws once from the model's initial state with no
|
|
62
69
|
change listeners. The embedded CSS's class prefix (`sw-*`) tracks the
|
|
63
70
|
package name (`script_widget`), not the magic name -- it's an internal
|
|
64
|
-
styling namespace, not user-facing.
|
|
71
|
+
styling namespace, not user-facing. The box itself is always a plain gray
|
|
72
|
+
(no color/header change on success vs. failure); stdout and stderr are
|
|
73
|
+
merged into one white `.sw-output` block rather than two separately
|
|
74
|
+
colored ones.
|
|
65
75
|
- `src/script_widget/__init__.py` -- re-exports `ExerciseResult`/
|
|
66
76
|
`run_exercise`/`ExerciseOutputWidget`/`register_exercise_magic` from
|
|
67
77
|
`executor.py`/`widget.py`. Importing `script_widget` therefore both
|
|
@@ -121,6 +131,26 @@ registered (a no-op if inline mode isn't active, matching normal notebook
|
|
|
121
131
|
behavior in that case too). It's called in a `finally`, so a figure drawn
|
|
122
132
|
before an exception still gets flushed and shown, exactly like a real cell.
|
|
123
133
|
|
|
134
|
+
### Colored tracebacks
|
|
135
|
+
|
|
136
|
+
A `%%exercise` traceback is meant to look like a normal uncaught-exception
|
|
137
|
+
display, not a plain `traceback.format_exc()` dump. The backend gets this
|
|
138
|
+
for free by reusing IPython's own formatter rather than reimplementing it:
|
|
139
|
+
`ip.InteractiveTB.structured_traceback(*sys.exc_info())` +
|
|
140
|
+
`.stb2text(...)` -- exactly the call `InteractiveShell` itself makes before
|
|
141
|
+
printing an exception -- which returns text with real ANSI SGR escape
|
|
142
|
+
codes (IPython 9's traceback formatter is pygments-based, so source-context
|
|
143
|
+
lines carry full syntax highlighting via 256-color codes, not just the 16
|
|
144
|
+
basic ones used for the exception header/filename/line number). The
|
|
145
|
+
frontend has no ANSI-rendering library to lean on (`_ESM` is dependency-free
|
|
146
|
+
by design), so `widget.py`'s `_ESM` embeds a small SGR-code interpreter
|
|
147
|
+
(`ansiToHtml`/`applySGR`/`xterm256`) that turns those escape codes into
|
|
148
|
+
colored `<span>`s, using the exact hex values JupyterLab itself uses for
|
|
149
|
+
`.ansi-*-fg` so the result matches a real notebook's palette. Text with no
|
|
150
|
+
escape codes at all (the no-`ip` fallback path's plain
|
|
151
|
+
`traceback.format_exc()`) round-trips through the same function as a single
|
|
152
|
+
unstyled text node.
|
|
153
|
+
|
|
124
154
|
## Gotchas
|
|
125
155
|
|
|
126
156
|
- **Mutating a shared object via an import IS visible outside the cell.**
|
|
@@ -164,8 +194,14 @@ Pixi-managed (config in `pyproject.toml` under `[tool.pixi.*]`; channels
|
|
|
164
194
|
(dev/test only, for the figure-capture tests), `quarto`/`quartodoc`,
|
|
165
195
|
`pytest`.
|
|
166
196
|
|
|
167
|
-
- Dev install: `pixi run install-dev` (
|
|
197
|
+
- Dev install: `pixi run install-dev` (`pip install --no-build-isolation
|
|
198
|
+
--force-reinstall --no-deps .` -- a real, **non-editable** install, despite
|
|
199
|
+
the task name; re-run it after every `src/` edit or `import script_widget`
|
|
200
|
+
picks up the stale previously-installed copy, not your change).
|
|
168
201
|
- Run tests: `pixi run test` (== `pytest test/`).
|
|
202
|
+
- Run a single test: `pixi run pytest test/test_executor.py::test_exception_is_caught_and_reported`
|
|
203
|
+
(or plain `pytest ...` -- `test/conftest.py` puts `src/` on `sys.path`, so
|
|
204
|
+
this works even without `install-dev`).
|
|
169
205
|
- Try the widget: open a notebook, `import script_widget`, then
|
|
170
206
|
```
|
|
171
207
|
%%exercise
|
|
@@ -184,6 +220,11 @@ Pixi-managed (config in `pyproject.toml` under `[tool.pixi.*]`; channels
|
|
|
184
220
|
- Release: `pixi run bump` / `release` / `version` drive
|
|
185
221
|
`scripts/bump_version.py` + a tag push, which triggers the conda/PyPI
|
|
186
222
|
workflows.
|
|
223
|
+
- Code review: `/review <target-file>` fans out specialist subagents
|
|
224
|
+
(Python, frontend, API consistency, UI heuristics, theming) into a
|
|
225
|
+
prioritized report under `.claude/review-reports/`; `/review-apply`
|
|
226
|
+
applies that report's findings in small, test-gated, one-commit-per-batch
|
|
227
|
+
steps. See `review-kit/README.md` for the full workflow.
|
|
187
228
|
|
|
188
229
|
## Distribution
|
|
189
230
|
|