Skip to content

Move REPL execution paths to main_modes/repl.py#1817

Merged
rolandwalker merged 1 commit intomainfrom
RW/extract-main-repl-execution-path
Apr 4, 2026
Merged

Move REPL execution paths to main_modes/repl.py#1817
rolandwalker merged 1 commit intomainfrom
RW/extract-main-repl-execution-path

Conversation

@rolandwalker
Copy link
Copy Markdown
Contributor

@rolandwalker rolandwalker commented Apr 4, 2026

Description

Motivation: move code out of the monolithic main.py into logical layers.

There is no functional change for this refactor, just the creation of main_modes/repl.py and the migration of (some of) the REPL logic out of main.py.

There is much more to do, just in relation to the REPL. For example, complete_while_typing_filter() doesn't logically still belong in main.py, but it is bound up with state set in main.py. Likewise, the updates of the prompt string, and similar updates of window title and toolbar, logically belong with the REPL, but are a bit interwoven with other code in main.py.

Another desirable change might be migrating the handlers in key_binding_utils.py to repl.py or some new file repl_handlers.py.

We might also consider now removing sections of the relatively brittle tests in test_main_regression.py which relate to the REPL, and a note is left to that effect.

run_cli() is left in place for now, but the intention is to fully replace it with main_repl().

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Apr 4, 2026
Motivation: move code out of the monolithic main.py into logical layers.

There is no functional change for this refactor, just the creation of
main_modes/repl.py and the migration of (some of) the REPL logic out of
main.py.

There is much more to do, just in relation to the REPL.  For example,
complete_while_typing_filter() doesn't logically still belong in
main.py, but it is bound up with state set in main.py.  Likewise, the
updates of the prompt string, and similar updates of window title and
toolbar, logically belong with the REPL, but are a bit interwoven with
other code in main.py.

Another desirable change might be migrating the handlers in
key_binding_utils.py to repl.py or some new file repl_handlers.py.

We might also consider now removing sections of the relatively brittle
tests in test_main_regression.py which relate to the REPL, and a note
is left to that effect.

run_cli() is left in place for now, but the intention is to fully
replace it with main_repl().
@rolandwalker rolandwalker force-pushed the RW/extract-main-repl-execution-path branch from e616cca to 5c4d3e3 Compare April 4, 2026 21:44
@rolandwalker rolandwalker merged commit 6f2b4c4 into main Apr 4, 2026
8 checks passed
@rolandwalker rolandwalker deleted the RW/extract-main-repl-execution-path branch April 4, 2026 21:47
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