[RFC] run_config(): skip interrupt if config_file not found#550
Closed
tony wants to merge 1 commit into
Closed
Conversation
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.
run_config(), skip interrupt if config_file not foundrun_config(): skip interrupt if config_file not found
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #549
Problem
Downstream packages (e.g. django-extension's
shell_plus) useptpython.repl.run_config()to use the system's optional ptpython config files. The result is users can be surprised byrun_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 ifrun_config()returns an empty value.What this change does
Adds
interrupt_if_not_foundwith default of False.Other options
Do nothing, accept current behavior
interrupt_if_not_founddefault toTrueThis means downstream packages will need to check
ptpythonversion and expliclitly opt in viainterrupt_if_not_found=False.[RFC]
run_config(): skip interrupt unless explicitly passedconfig_file#551: Only interrupt if explicitconfig_filepassedRemove default
config_fileparam.Return
Noneif noconfig_filepassed.