Skip to content

[RFC] run_config(): skip interrupt if config_file not found#550

Closed
tony wants to merge 1 commit into
prompt-toolkit:masterfrom
tony:run-config-without-interrupt
Closed

[RFC] run_config(): skip interrupt if config_file not found#550
tony wants to merge 1 commit into
prompt-toolkit:masterfrom
tony:run-config-without-interrupt

Conversation

@tony
Copy link
Copy Markdown
Contributor

@tony tony commented Sep 4, 2023

Resolves #549

Problem

Downstream packages (e.g. django-extension's shell_plus) use ptpython.repl.run_config() to use the system's optional ptpython config files. The result is users can be surprised by run_config() interrupting the terminal for a config file they didn't explicitly request: ptpython had the default.

Current behavior

run_config() specifies a default configuration file, which may or may not exist on systems.
ptpython.repl.embed() runs flawlessly if run_config() returns an empty value.

What this change does

Adds interrupt_if_not_found with default of False.

Other options

  • Do nothing, accept current behavior

  • interrupt_if_not_found default to True

    This means downstream packages will need to check ptpython version and expliclitly opt in via interrupt_if_not_found=False.

  • [RFC] run_config(): skip interrupt unless explicitly passed config_file #551: Only interrupt if explicit config_file passed

  • Remove default config_file param.

    Return None if no config_file passed.

run_config() specifies a default configuration file, which may or may not
exist on systems. embed() runs flawlessly if run_config() returns an empty
value.

Downstream packages (e.g. django-extension's shell_plus) use run_config()
to use the system's optional ptpython config files. The default result is
users are surprised by run_config() interrupting them for a config file
not explicitly requested: ptpython had the default.

Adds interrupt_if_not_found with default of False.
@tony tony changed the title RFC: run_config(), skip interrupt if config_file not found [RFC] run_config(): skip interrupt if config_file not found Sep 4, 2023
@tony
Copy link
Copy Markdown
Contributor Author

tony commented Nov 3, 2023

Resolved via merge of #551 in d25e678.

If there's any more commentary on this please feel free to ping / create a separate issue, and reference this issue and/or #549.

@tony tony closed this Nov 3, 2023
@tony tony deleted the run-config-without-interrupt branch November 3, 2023 15:05
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.

ptpython.run_config() / embed() "Impossible to read" interrupt with default usage

1 participant