Skip to content

docs: make the README examples runnable pycon doctests (#101) - #103

Open
tschm wants to merge 2 commits into
alihaskar:masterfrom
tschm:rhiza_fix_101_20260930
Open

tschm wants to merge 2 commits into
alihaskar:masterfrom
tschm:rhiza_fix_101_20260930

Conversation

@tschm

@tschm tschm commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #101

Acceptance criterion (verbatim):

check_doc_examples.py --source-root src reports no +RHIZA_SKIP Python fences in README.md, and make rhiza-test passes.

The issue let each fence either run in CI or move into a doctest. The maintainer chose runnable examples, written as standard pycon doctest sessions (>>> prompts followed by the expected output).

What changed

  • README.md: every Python example is now a pycon block, including the ones that were already running. The four that used to be skipped:
    • Overlays vs subplots builds seeded synthetic OHLC data (300 bars), derives SMA/EMA overlays and two subplots with pandas, and calls plot(...).
    • Subplot series types computes its indicator arrays (RSI, MACD, volume, events) from that data and plots the dict.
    • Trade markers runs against the same data.
    • plot signature: the annotated pseudo-signature, which wasn't valid Python, is now a real call that passes every parameter by keyword with its default noted. The parameter list below it now also documents server_timeout and block.
  • The stop_server / get_server_status examples moved up into Quick start. Their documented output (No active server to stop, server_info: None) is only true before any chart is plotted. Their API-reference entries now point there.
  • plot()'s real console output is shown as the expected output. # doctest: +ELLIPSIS matches the parts that change each run (port, timestamp) as ..., so the README needs no redirect_stdout workaround. Each call passes open_browser=False, block=False so it runs unattended, and a sentence explains dropping those in a normal script.
  • tests/test_readme_doctest.py (new): runs python -m doctest README.md in a subprocess. That's the command the README gives readers, and the subprocess keeps the real server thread and session registry out of the pytest worker. This test does the executing, because rhiza's README check only runs ```python fences. It uses no pytest.ini change (that file is template-owned). I checked that it fails: a copy of the README with one wrong output line exits 1.

Gates

  • make fmt: pass (markdownlint included)
  • make rhiza-test: pass, 32 passed, 3 skipped (no version tags). There are no python fences left for its README runner, so it now passes trivially on that part. The examples are exercised by make test instead.
  • make test: pass, 179 tests (including the README doctest), 100% coverage
  • python -m doctest README.md: pass
  • check_doc_examples.py --source-root src: no +RHIZA_SKIP fences

Closes #101

🤖 Generated with Claude Code

@tschm tschm changed the title docs: make the four skipped README Python fences executable (#101) docs: make the README examples runnable pycon doctests (#101) Sep 30, 2026

This branch has not been deployed

No deployments
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.

Make the four +RHIZA_SKIP README Python fences executable

1 participant