Skip to content

docs: fix broken runblock examples; showwindow defaults to current axes - #161

Merged
petercorke merged 5 commits into
mainfrom
docs/fix-runblock-examples
Oct 22, 2026
Merged

petercorke merged 5 commits into
mainfrom
docs/fix-runblock-examples

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

sphinx-pyrunblock prints !! [RUNBLOCK-ERROR] for a docstring example that raises, but the docs build still succeeds, so the tracebacks were being published. This fixes the examples that are example or signature mistakes:

  • Blobs.vc: blobs.v → blobs.vc
  • Image.array_as: array_int() → array_as()
  • Image.A: build a new Image instead of assigning to the now read-only .A
  • Image.fiducial: tags.png is not shipped; use apriltag12.png with '36h11'
  • Image.showwindow: ax now defaults to None (the current axes), as the inner Window class and the documented examples already assumed. This is a small API fix, not just a docs fix. Also fixed the runblock, removed a duplicate .. plot:: block that used an undefined window, and corrected Window.move's return annotation. Adds tests/test_image_showwindow.py (3 tests; showwindow was untested).
  • ImageTensor.Tensor and docs/source/tensor.rst: PyTorch is optional and not installed in the docs build, so these are now non-executed code-block:: pycon blocks.
  • Blobs.plot_labelbox: the .. plot:: source had its statements on one line (a SyntaxError that the plot directive reports only as a warning); also removes a leftover debugging print(options).

Related issue

Refs #159 (not Fixes: the checklist there is not finished, see below).

Not in this PR

Verification

Local sphinx-build -b html docs/source docs/build/html in a clean venv (Sphinx 9.1.0, sphinx-pyrunblock 1.2.0, OpenCV 5.0.0.93), compared with main at 77a3da9c: RUNBLOCK-ERROR lines 19 → 2 (both draw_point), ordinary warnings 111 → 109. Each fixed example was also run directly. pytest tests: 986 passed, 96 skipped. The combined effect with the #158 fix has not been built together.

Checklist

  • PR title follows Conventional Commits
  • Tests pass locally (pytest)
  • Added tests for the changed showwindow signature
  • Docstrings updated; no new typed signatures other than -> np.ndarray | None on Window.move

🤖 Generated with Claude Code

petercorke and others added 3 commits October 21, 2026 15:52
sphinx-pyrunblock prints "!! [RUNBLOCK-ERROR]" for an example that raises
but the build still succeeds, so these tracebacks were being published.
Fix the ones that are example or signature mistakes:

- Blobs.vc: blobs.v -> blobs.vc
- Image.array_as: array_int() -> array_as()
- Image.A: build a new Image instead of assigning to the now read-only .A
- Image.fiducial: tags.png is not shipped; use apriltag12.png with '36h11'
- Image.showwindow: ax now defaults to None (the current axes), as the
  Window class and the documented examples already assume; fix the
  runblock, drop a duplicate .. plot:: block that used an undefined
  `window`, and correct Window.move's return annotation
- ImageTensor.Tensor and tensor.rst: PyTorch is optional and not installed
  in the docs build, so make these non-executed code blocks

Adds tests/test_image_showwindow.py (previously untested).

Refs #159. Image.draw_point still fails on OpenCV 5 (#158), so the build
still reports 2 RUNBLOCK-ERROR lines (was 19) and pycon_fail_on_error is
not enabled here.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The .. plot:: block had 'im = Image.Read(...) im.disp() blobs = im.blobs()'
on a single line, a SyntaxError that the plot directive reports only as a
warning, so the example image was missing from the docs.

Refs #159.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
It printed the styling options dict to stdout on every call.

Refs #159.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity · 0 duplication

Metric Results
Complexity 7
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit d770ddd into main Oct 22, 2026
39 checks passed
@petercorke
petercorke deleted the docs/fix-runblock-examples branch October 22, 2026 02:12
@github-actions github-actions Bot mentioned this pull request Oct 22, 2026
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