Skip to content

Sequence pre-0.1.0 API waves around terminal.py serialization #36

Done
8 of 8 issues completed
Done

Description

@tony

Summary

Umbrella execution plan for landing the pre-0.1.0 architecture and API changes in #34 across four ordered pull-request waves without stalling on merge conflicts in src/libvt/terminal.py, CHANGES, or Sphinx cross-references. Leaf schema changes (Profile capability groups, open Event base) land in parallel worktrees first, libvt.contrib.tmux and Policy follow once those types exist, committed Appearance and input/AsyncSession slices serialize only where they touch Terminal, and the PEP 562 src/libvt/__init__.py cutover lands last so every public symbol and MyST {class} target moves once.

Motivation

  • src/libvt/terminal.py imports almost every sibling module in src/libvt/ and concentrates Snapshot, _SyncState, Formatter, Terminal, CSI/OSC/DCS handlers, encode(), and from_tmux_capture() in one file, so running uncoordinated long-lived branches against master produces overlapping edits across Terminal.__init__, _queue_reply(), and mode/OSC dispatch tables.
  • Shrinking libvt.__all__ in src/libvt/__init__.py before Appearance, KnownEvent, libvt.profiles, and libvt.contrib.tmux exist in their final modules forces a second rewrite of __all__, Sphinx {class} roles across docs/, docs/project/public-api.md, and MIGRATION.
  • Unreleased deliverables in CHANGES insert immediately below the <!-- END PLACEHOLDER ... --> marker, so parallel pull requests that commit CHANGES entries early conflict on identical header lines.

Evidence

Module import fan-in and root-attribute reference audit at 6c33073
  1. Inspecting src/libvt/*.py line counts and internal libvt.* imports at 6c33073 confirms terminal.py (4888 lines, 13 internal module dependencies) and __init__.py (14 eager submodule imports) are the two high-fan-in files while config.py, events.py, modes.py, style.py, and input.py stay small and decoupled:
$ python3 -c "import ast, pathlib; src = pathlib.Path('src/libvt'); [print(f'{p.name:18s} {len(p.read_text().splitlines()):5d}L  deps={len({n.module for n in ast.walk(ast.parse(p.read_text())) if isinstance(n, ast.ImportFrom) and n.module and n.module.startswith(\"libvt\")})}') for p in sorted(src.glob('*.py'))]"
__about__.py          16L  deps=0
__init__.py          283L  deps=14
__main__.py           54L  deps=2
_grid.py            1286L  deps=2
_ucd.py              460L  deps=1
aio.py              1277L  deps=6
codec.py             241L  deps=3
config.py            413L  deps=0
events.py            388L  deps=2
exc.py               213L  deps=1
graphics.py         2127L  deps=2
input.py             674L  deps=2
modes.py             170L  deps=0
parser.py           1329L  deps=2
pytest_plugin.py     179L  deps=5
screen.py           1902L  deps=5
status.py            371L  deps=1
style.py             207L  deps=0
terminal.py         4888L  deps=13
testing.py          282L  deps=5
tmux.py             1555L  deps=8
  1. Auditing tests/ for non-quickstart libvt.<attr> accesses at 6c33073 shows tests/ already imports submodules directly except for 55 attribute lookups across 8 test files (Mode, StopOn, WidthRole, AnsiColor, display_width, UnderlineStyle, Parser, SyncToken, ColorScheme), whereas docs/ carries MyST {class} cross-references across 37 documentation files.

Proposal

Alternatives

  • Shrinking src/libvt/__init__.py in Wave 1 before new types and subpackages exist: rejected because Appearance, KnownEvent, libvt.profiles, and libvt.contrib.tmux would force repeated edits to __init__.py, Sphinx API pages, and MIGRATION.
  • Developing all pre-0.1.0 slices simultaneously on long-lived parallel branches: rejected because src/libvt/terminal.py concentrates mode, query, OSC, and snapshot state in a single file where concurrent refactors create avoidable merge conflicts.

References

Sub-issues

Sub-issues

8 of 8 Issues completed
Loading 8 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions