Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make drepl load config files like regular ipython #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dcolascione
Copy link

Instead of creating an interactive shell class instace ourselves, go through launch_new_instance and tell it the class to use. This way, startup behavior loads the same files and init scripts that the regular program does.

@astoff
Copy link
Owner

astoff commented Oct 3, 2024

Hi Daniel,

I was working on dREPL this week and just pushed some changes (this probably causes a conflict with your PR, sorry about that), in particular there is new option drepl-ipython-config which allows to add settings from Emacs.

Your suggestion is something different, of course, and it makes sense, but I would prefer a more direct implementation that doesn't load the "terminal" part of IPython. I guess the key is the class PyFileConfigLoader defined in traitlets package.

@astoff
Copy link
Owner

astoff commented Oct 3, 2024

For your reference, this is a discussion I had about configuration files vs. configuration injected by the editor: astoff/comint-mime#24

@dcolascione
Copy link
Author

I'm less interested in an Emacs-centric IPython than I am in a regular IPython that just happens to integrate better with Emacs than one running inside shell- or term-mode. It doesn't make sense to me to configure Emacs IPython one way and every other kind of IPython another way. Sure, you could close this gap by manually reimplementing the configuration loading (and other startup, like banner printing) logic from regular IPython, but why would you? It's chasing a moving target. Using the existing startup code from IPython works fine, and the IPython source suggests that even non-terminal editors are supposed to use the Application and associated IPython bootstrappers.

@dcolascione
Copy link
Author

Also, regarding the above comment, it seems fine for IPython hosts to inject settings they need to operate correctly, but they should layer these settings on top of the usual IPython initialization, not replace it.

@astoff
Copy link
Owner

astoff commented Oct 3, 2024

Yes, I see where you are coming from (I only really use IPython from Emacs, so my requirements are simpler).

As I see it, there are two kinds of configuration options for IPython: one is about how the interpreter itself (do you want automagic, etc.) and the other is UI-specific (keybindings, how to display graphics, etc.). The latter for sure needs "injected configuration", so that's why I did it. For the first kind, it would be nice indeed to read the usual configuration file.

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.

2 participants