astoff / comint-mime

Display graphics and other MIME attachments in Emacs shells
66 stars 7 forks source link

Q: should ipython configurations from within emacs be encouraged? #24

Open pank opened 1 month ago

pank commented 1 month ago

If comint-mime-prefer-svg is non-nil, the ipython config might be overwritten (e.g. ~/.ipython/profile_default/ipython_config.py). Is it desirable for emacs to configure ipython? I guess it maybe is, since most other ipython consoles are "smarter" than emacs these days (e.g. the qtconsole) so maybe you want to reserve ipython_config.py for those? On the other hand, I would find it confusing if my ipython settings are "overwritten" via comint-mime.

Maybe it's fine to just have such config nil by default?
Or maybe it's better to point out how to configure ipython in reasonable ways in docstrings and the README?

astoff commented 1 month ago

That's a tricky question. In principle I'd say the config file should be respected. That said, this file probably includes some "console-dependent" (such as supported image formats) and some "console-independent" settings (such as preferred color schemes), and it's also probably hard to tell the two classes of settings apart from each other.

I don't use an ipython config file, if you could give me some insight on what kind of settings people typically do there it might help with those design questions.

pank commented 1 month ago

I mostly use it to improve the output of matplotlib_inline tbh. I am not sure what they are generally used for but there's an introduction.

c = get_config()

c.TerminalInteractiveShell.confirm_exit = False
c.InteractiveShellApp.extensions = ["autoreload"]
c.InteractiveShellApp.exec_lines = ["%autoreload 2"]

c.InlineBackend.figure_formats = {"svg"}
c.InlineBackend.print_figure_kwargs = {'bbox_inches': None}
c.InteractiveShellApp.exec_lines = ["%matplotlib inline"]
jabirali commented 6 days ago

Maybe it's fine to just have such config nil by default? Or maybe it's better to point out how to configure ipython in reasonable ways in docstrings and the README?

For my use case, I think asking the user to configure IPython would make things harder:

My opinion would therefore be that it's perhaps better to keep the current default, where the setting is nil by default but injects some IPython config if the user turns it on?