Skip to content

architecture(docs): Clarify lazy root imports - #208

Merged
tony merged 1 commit into
masterfrom
docs/201-architecture-lazy-imports
Dec 5, 2026
Merged

tony merged 1 commit into
masterfrom
docs/201-architecture-lazy-imports

Conversation

@tony

@tony tony commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #201

Summary

  • Updates docs/topics/architecture.md to match PEP 562 lazy root exports (src/libvt/__init__.py) and post-core(refactor): Split views, snapshot, dispatch, recorder, target, and aio (#203) #204/docs(api): Add per-module pages and split aio #205 module boundaries (views, snapshot, format, recorder, aio/, contrib/): cold import libvt loads only package metadata (__version__); Terminal, render, and strip load libvt.terminal and the emulation engine; Snapshot and Screen load Unicode tables (_ucd), grid storage, views, snapshots, and formatting without libvt.terminal or libvt.parser (Snapshot also leaves libvt.screen and libvt.input unloaded); pytest_plugin / pytest11 entry points stay cold until fixture invocation; libvt.aio defers POSIX pty/termios to open_pty().
  • Replaces {mod}\libvt`with{doc}targets so strict and nitpicky Sphinx builds resolve cleanly againstdocs/api/libvt.md (:no-index:`).
  • Expands test_import_libvt_and_pytest_plugin_leave_subsystems_unloaded() in tests/test_libvt.py to 9 independent cold subprocess checks covering exact loaded libvt.* module sets, first-access vars(libvt) caching, strip, independent Snapshot vs Screen, pytest11 entry points, and libvt.aio.

Verification

  • Ruff, ty (3.12–3.15 + win32 3.12), pytest (1241 passed, 2 skipped), Sphinx dirhtml -W and nitpicky -n (zero warnings on touched pages).
  • Independent staff review verdict: adopt as is (Gates 1–4 PASS, new code 9.6/10, all applicable items 9.0–9.7/10).

why: The architecture guide stated that importing libvt loads emulation,
input, and formatting modules, contradicting PEP 562 lazy root exports
in libvt.__init__ and docs/project/public-api.md.

what:
- Describe PEP 562 lazy root resolution, Terminal/render/strip versus
  Snapshot and Screen module loading, cold pytest11 discovery, and aio
  and contrib boundaries in docs/topics/architecture.md
- Align architecture module summaries with views, snapshot (Snapshot,
  SyncToken, ScreenDelta), format, recorder, aio, and contrib
- Expand cold-subprocess import checks in tests/test_libvt.py for exact
  loaded module sets, first-access caching, strip, independent Snapshot
  and Screen loads, pytest11 entry points, and libvt.aio
- Record the documentation update in CHANGES

Fixes #201
@tony
tony merged commit 11e76c7 into master Dec 5, 2026
9 checks passed
@tony
tony deleted the docs/201-architecture-lazy-imports branch December 5, 2026 17:02
@tony tony mentioned this pull request Dec 5, 2026
35 of 38 tasks

This branch was successfully deployed

1 active deployment
docs — 0df45f78 Deployed Dec 5, 2026 by tony via build (3.14) #506
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.

Correct the architecture guide’s description of lazy imports

1 participant