Repository navigation
Done
8 / 88 of 8 issues completedDone
8 / 88 of 8 issues completed
Copy link
Labels
enhancementNew feature or request
Description
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.pyimports almost every sibling module insrc/libvt/and concentratesSnapshot,_SyncState,Formatter,Terminal, CSI/OSC/DCS handlers,encode(), andfrom_tmux_capture()in one file, so running uncoordinated long-lived branches againstmasterproduces overlapping edits acrossTerminal.__init__,_queue_reply(), and mode/OSC dispatch tables.- Shrinking
libvt.__all__insrc/libvt/__init__.pybeforeAppearance,KnownEvent,libvt.profiles, andlibvt.contrib.tmuxexist in their final modules forces a second rewrite of__all__, Sphinx{class}roles acrossdocs/,docs/project/public-api.md, andMIGRATION. - Unreleased deliverables in
CHANGESinsert immediately below the<!-- END PLACEHOLDER ... -->marker, so parallel pull requests that commitCHANGESentries early conflict on identical header lines.
Evidence
Module import fan-in and root-attribute reference audit at 6c33073
- Inspecting
src/libvt/*.pyline counts and internallibvt.*imports at 6c33073 confirmsterminal.py(4888lines,13internal module dependencies) and__init__.py(14eager submodule imports) are the two high-fan-in files whileconfig.py,events.py,modes.py,style.py, andinput.pystay 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
- Auditing
tests/for non-quickstartlibvt.<attr>accesses at 6c33073 showstests/already imports submodules directly except for55attribute lookups across8test files (Mode,StopOn,WidthRole,AnsiColor,display_width,UnderlineStyle,Parser,SyncToken,ColorScheme), whereasdocs/carries MyST{class}cross-references across37documentation files.
Proposal
- Wave 1 (parallel leaf foundations in isolated worktrees): land
Profilecapability groups + East Asianambiguous_width+src/libvt/profiles.py(SplitProfileinto capability groups and addlibvt.profiles#37) alongside the openclass Eventbase +KnownEvent+OSC 133/633normalization (MakeEventan open base class and normalizeOSC 133/OSC 633#38); their leaf modules (config.py/_ucd.pyvsevents.py) are disjoint, and theirterminal.pyedits touch non-overlapping handler regions (query/reset vs_emit_eventandOSC 133/633). - Wave 2 (integration boundary and
Policycontrols, gated on Wave 1): movesrc/libvt/tmux.pyintosrc/libvt/contrib/tmux/{__init__,profile,capture,control}.pywithtmux_profile()built directly on Wave 1'sProfilecapability groups and removefrom_tmux_capture()fromTerminalandSnapshot(Movetmuxinto decoupledlibvt.contrib.tmuxsubmodules #39); landPolicy.emit_replies,ClipboardReadPolicy(ClipboardReadRequestedsubclassing Wave 1'sEvent),DECRQCRApolicy removal,Terminal.enqueue_reply(), andParser.at_ground_state(Add passive-observer andOSC 52Policycontrols inlibvt#40). Once Wave 2 merges,0.2.0TmuxControlParserwork (Add byte-orientedTmuxControlParserand two-phase-CCPaneAttach#27) and notification events (Emit typed notification events forOSC 9, KittyOSC 99, andOSC 777#31) are unblocked in parallel without core churn. - Wave 3 (committed frame state and session driving, gated on Wave 2): land committed
AppearanceinsideSnapshotand_SyncStateplusTerminal.set_theme()(?2031, respecting Wave 2'sPolicy.emit_replies) andDECSCNM(?5) (Track committedAppearanceacross?2026holds andset_theme()#41); in parallel onmodes.py/input.py/aio.py, landXTSAVE/XTRESTORE(SupportXTSAVE(CSI ? Pm s) andXTRESTORE(CSI ? Pm r) private mode save/restore #29),?8/?66/?67,MouseTracker, and bidirectionalAsyncTerminalStream/AsyncSession(Add?8/?66/?67input modes,MouseTracker, andAsyncSession#42), serializing only the smallterminal.pymode-table merge. - Wave 4 (root namespace cutover, gated on Waves 1–3): shrink
src/libvt/__init__.pybehind a static PEP 562__getattr__and__dir__map onceAppearance,KnownEvent,libvt.profiles, andlibvt.contrib.tmuxsit in their final modules, enforcepytest11startup hygiene intests/test_libvt.py, and run a single mechanical sweep acrossconftest.py,tests/,docs/,docs/project/public-api.md, andMIGRATION(Shrinklibvt.__all__behind PEP 562 and gatepytest11imports #43). - Cross-cutting branch discipline: keep short-lived stacked or per-wave branches against
master, addCHANGESentries in the final commit before merge to avoid placeholder-header collisions, verifyruff,ty,pytest, andjust build-docson every slice, and attach subprocesssys.modulesratchets in Wave 2 (core never importslibvt.contrib.*;capture,control, andprofilestay decoupled) and Wave 4 (import libvt.pytest_pluginnever loadslibvt.terminalorlibvt._ucd).
Alternatives
- Shrinking
src/libvt/__init__.pyin Wave 1 before new types and subpackages exist: rejected becauseAppearance,KnownEvent,libvt.profiles, andlibvt.contrib.tmuxwould force repeated edits to__init__.py, Sphinx API pages, andMIGRATION. - Developing all pre-
0.1.0slices simultaneously on long-lived parallel branches: rejected becausesrc/libvt/terminal.pyconcentrates mode, query, OSC, and snapshot state in a single file where concurrent refactors create avoidable merge conflicts.
References
- Design specification and roadmap: Move
tmuxtolibvt.contrib.tmuxand harden pre-0.1core APIs #34,0.0.xto0.1.0and beyond Roadmap #35 - Wave sub-issues: Split
Profileinto capability groups and addlibvt.profiles#37, MakeEventan open base class and normalizeOSC 133/OSC 633#38, Movetmuxinto decoupledlibvt.contrib.tmuxsubmodules #39, Add passive-observer andOSC 52Policycontrols inlibvt#40, Track committedAppearanceacross?2026holds andset_theme()#41, Add?8/?66/?67input modes,MouseTracker, andAsyncSession#42, Shrinklibvt.__all__behind PEP 562 and gatepytest11imports #43, SupportXTSAVE(CSI ? Pm s) andXTRESTORE(CSI ? Pm r) private mode save/restore #29 - Downstream
0.2.0+consumers and runtime track: Add byte-orientedTmuxControlParserand two-phase-CCPaneAttach#27, Emit typed notification events forOSC 9, KittyOSC 99, andOSC 777#31, CertifyPyPy 3.12compatibility acrossOSErrorreduction andarray('Q')grids #32 - High-fan-in files at 6c33073:
src/libvt/terminal.py,src/libvt/__init__.py,conftest.py,CHANGES
Sub-issues
Collapse Sub-issuesSub-issues
Loading 8 sub-issues
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Type
Projects
- StatusShow more project fieldsDone
Activity
Profileinto capability groups and addlibvt.profiles#37Eventan open base class and normalizeOSC 133/OSC 633#38tmuxinto decoupledlibvt.contrib.tmuxsubmodules #39OSC 52Policycontrols inlibvt#40Appearanceacross?2026holds andset_theme()#41?8/?66/?67input modes,MouseTracker, andAsyncSession#42libvt.__all__behind PEP 562 and gatepytest11imports #43XTSAVE(CSI ? Pm s) andXTRESTORE(CSI ? Pm r) private mode save/restore #290.0.xto0.1.0and beyond Roadmap #35tony commentedon Nov 28, 2026
All four pre-0.1.0 API waves (#44-#51) and follow-up protocol slices (#52-#57) landed on master and shipped in v0.0.1a2.