Skip to content

Implement the typed doctest core architecture - #93

Draft
tony wants to merge 6 commits into
adr-doctest-core-architecturefrom
adr-doctest-core-architecture-spike-00
Draft

Implement the typed doctest core architecture#93
tony wants to merge 6 commits into
adr-doctest-core-architecturefrom
adr-doctest-core-architecture-spike-00

Conversation

@tony

@tony tony commented Aug 8, 2026

Copy link
Copy Markdown
Member

Depends on #92.

Summary

  • Implement the proposed typed, host-neutral doctest_core pipeline for parsing, projection, registration, and execution.
  • Refactor doctest_docutils and pytest_doctest_docutils as adapters over the core while preserving their command and collection surfaces.
  • Keep pytest shared-state groups schedulable as one item while retaining an independent doctest.DocTest and source location for each block.
  • Expand compatibility coverage and pin the CI matrix to exact supported docutils, pytest, pytest-asyncio, and pytest-rerunfailures versions.

The architecture ADR remains proposed. This draft implements it against the existing direct and pytest entry points so the contracts can be reviewed against executable behavior.

Why

The direct and pytest paths previously owned overlapping parsing and execution behavior. The pytest adapter also blocked the standard doctest plugin while depending on its implementation. A shared core separates host integration, scheduling identity, and diagnostic identity without merging source blocks or adding an xdist affinity protocol.

Impact

Documentation blocks within a group share one namespace, but each block retains its own location and failure detail. The pytest adapter coexists with the standard doctest plugin, so pytest continues to provide fixtures, checker and report options, and Python-module doctest collection.

Validation

  • uv run ruff format . --check
  • uv run py.test
  • uv run ruff check .
  • uv run mypy .
  • just build-docs

Known CI failure

The push workflow fails in mypy for Python 3.13 with docutils==0.21.2 and pytest==7.2.0. An isolated local run with the same pins reproduces strict typing errors in src/_pytest_doctest_compat.py and src/pytest_doctest_docutils.py; the equivalent pytest==8.4.2 run passes. The oldest pytest line exposes the private compatibility surface with weaker annotations, so the blocker remains unresolved.

tony added 6 commits August 8, 2026 07:03
why: Test the ADR boundaries against stock prompt semantics, typed
markup extraction, shared groups, and extended execution.

what:
- Add immutable contracts, settings, models, and registry snapshots
- Extract and project reStructuredText and MyST into group recipes
- Run prompt and exec lanes with typed results and cleanup policy
- Cover projection, runtime, registry, and Sphinx doctree behavior
why: Keep the released direct API and command shape while exercising the
same extraction, projection, and execution path as other hosts.

what:
- Adapt the finder and direct runner to typed block and group results
- Preserve stock failure and summary accounting across Python versions
- Add direct facade ordering, location, and reporting regressions
why: Preserve pytest fixtures, checker semantics, and reporting without
blocking the built-in doctest plugin or splitting shared group state.

what:
- Add one item per group with fresh attempt-local doctest materialization
- Quarantine private pytest compatibility and filter duplicate collectors
- Exercise fixtures, reruns, xdist, async fixtures, and contributions
- Package the typed core, adapters, tests, and corrected plugin entry point
why: Broad major-version constraints hid invalid dependency combinations
and did not prove the declared Python and pytest floor.

what:
- Pin docutils, pytest, asyncio, and rerun plugin matrix versions
- Select the matrix interpreter for every uv command
- Check installed dependency consistency before static and runtime gates
why: The proposed architecture contained compatibility and lifecycle
claims that changed when exercised against real hosts and version floors.

what:
- Record the typed-core and thin-adapter bakeoff result
- Narrow vanilla, diagnostics, line, and pytest compatibility promises
- Define runner and registry contracts proven by the implementation
- List deferred host lifecycle, reporting, async, and facade work
why: Public guidance must distinguish the direct command from pytest's
one-item-per-group behavior without promising full stdlib transcripts.

what:
- Describe direct doctest command and summary behavior
- Explain built-in pytest doctest plugin composition
- Clarify bare-block isolation and the Sphinx default directive group
- State the supported docutils range
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