Closed pycadelic closed 5 years ago
Hey,
Thanks for feedback. Bear in mind I'm just getting started with all this python stuff!
It seems that configure() is conditionally defined in ptpython's entry_points/run_ptpython.py, so I don't see how it's possible to make use of that function.
Instead I thought about checking if config.py exists and adapting the configure= introducted in the original pull request based on that.
I moved my config.py out of the way and it seems to work ok now without having to press enter to continue past the warning.
˜
Ah, I see. To clarify: I meant that you could define the same sort of configure
function that ptpython does. Something like
def configure(repl):
config_path = os.path.expanduser("~/.ptpython/config.py")
if os.path.exists(path):
run_config(repl, path)
embed(globals=self.context, vi_mode=self.ptpy_vi_mode, configure=configure)
How about this way? Just to reuse what was already done. Interesting, that flake8 thing. I'll dig into it, good tip!
I agree that the other version is cleaner and has less duplication.
Give me a few days, and I'll get back to you about it!
@pycadelic I went ahead and made the minor adjustment in #56 . Thanks again for working on this!
Without this small change, ptpython, when launched with konch, will load with default settings rather than reading ~/.ptpython/config.py.
I've tested it and it works as expected with flask-konch, which of course uses konch itself. In other words, "flask konch" now correctly loads ptpython with the settings in config.py, whereas before this change, it loaded ptpython with default settings.