Skip to content

Cut 5 Textual/widget import chains out of toad.client (22 -> 17) - #2228

Merged
trissim merged 1 commit into
mainfrom
toad-qt/cut-client-textual-chokepoints
Nov 24, 2026
Merged

trissim merged 1 commit into
mainfrom
toad-qt/cut-client-textual-chokepoints

Conversation

@trissim

@trissim trissim commented Nov 24, 2026

Copy link
Copy Markdown

Summary

Cuts 5 unnecessary Textual / toad.widgets import chains out of toad.client:

  • Moved Textual-only src/toad/client/fragment_states.py to src/toad/widgets/fragment_states.py (its sole importer is toad.widgets.transcript_history), removing the last toad.widgets import under toad.client.
  • Switched SettingsDeclaration (setting_declarations.py) and ObjectConfiguration (object_configuration.py) from Textual's SettingsScope (DOMNode) to toolkit-neutral ViewSettingsOwner (toad.client.view_settings), which every SettingsDeclaration(scopes=...) already uses.
  • Replaced view.feedback.flash(Content(...), style='success') in AgentBase.change_project (agent.py) with view.flash_success(...) (FlashHost), dropping textual.content from toad.agent and making change_project work on Qt too.
  • Replaced textual._partition.partition in directory.py and textual.cache.LRUCache in path_search_ranking.py with stdlib helpers, freeing toad.client.project_paths from Textual.

Checks

  • toad.client -> textual count dropped from 22 -> 17 (0 toad.widgets imports under toad.client).
  • tools/guarded_imports.py: 0.
  • pytest -q tests/guards/test_shared_hook_sequences.py tests/model/test_message_files.py tests/guards/test_deleted_interface_mechanisms.py tests/guards/test_test_layers.py: 60 passed.

- Move Textual-only toad.client.fragment_states to toad.widgets.fragment_states (only imported by toad.widgets.transcript_history), eliminating the last toad.widgets import under toad.client.
- Type SettingsDeclaration and ObjectConfiguration against toolkit-neutral ViewSettingsOwner (toad.client.view_settings) instead of Textual's DOMNode-derived SettingsScope, freeing toad.client.{message_files,prompt_composer,sort_control} from Textual.
- AgentBase.change_project: call shared FlashHost.flash_success() instead of Textual's view.feedback.flash(Content(...), style='success'), removing textual.content from toad.agent and fixing Qt parity.
- toad.directory & toad.path_search_ranking: replace textual._partition.partition and textual.cache.LRUCache with stdlib helpers, freeing toad.client.project_paths from Textual.
@trissim
trissim merged commit 445fa0e into main Nov 24, 2026
1 of 2 checks passed
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