spyder-ide / spyder-notebook

Jupyter notebook integration with Spyder
Other
532 stars 130 forks source link

Using a different default backend for notebooks (inline) than the regular Spyder editor #467

Closed battaglia01 closed 1 month ago

battaglia01 commented 2 months ago

I generally use Spyder with mpl all the time, and when I do I usually like my plots to be interactive, so I rarely use the inline backend and instead use something like Qt5. When using spyder-notebook, however, this is super chaotic, as now we really do want images to render inline as we are in a notebook format. Instead, however, it opens a new window for each plot.

I feel like this is a pretty basic use case: most people using Spyder will probably want interactivity in a separate window when running Python scripts, but probably want something inline when doing things in the notebook format. For now, this can be solved by leaving the backend as Qt5, but manually typing something like %matplotlib inline every time at the top of each notebook. However, this is tedious, and since I'd imagine this is probably the typical use case for most people, it isn't great.

So, it would be very sensible if we could just somehow set a different default backend for notebooks than we have for editors, perhaps as a preference in the Notebook section of the preferences window.

For now, is there some way to get around this? Perhaps some kind of jupyter_notebook_config.py file we could edit or whatever?

Versions and main components

Dependencies

Please go to the menu entry Help > Optional Dependencies (or Help > Dependencies), press the button Copy to clipboard and paste the contents below:

Mandatory:

applaunchservices >=0.3.0 : 0.3.0 (OK) atomicwrites >=1.2.0 : 1.4.1 (OK) chardet >=2.0.0 : 5.2.0 (OK) cloudpickle >=0.5.0 : 3.0.0 (OK) cookiecutter >=1.6.0 : 2.6.0 (OK) diff_match_patch >=20181111 : 20230430 (OK) importlib_metadata >=4.6.0 : 8.0.0 (OK) intervaltree >=3.0.2 : 3.1.0 (OK) IPython >=8.13.0,<9.0.0,!=8.17.1 : 8.26.0 (OK) jedi >=0.17.2,<0.20.0 : 0.19.1 (OK) jellyfish >=0.7 : 1.0.4 (OK) jsonschema >=3.2.0 : 4.23.0 (OK) keyring >=17.0.0 : 25.2.1 (OK) nbconvert >=4.0 : 7.16.4 (OK) numpydoc >=0.6.0 : 1.7.0 (OK) parso >=0.7.0,<0.9.0 : 0.8.4 (OK) pexpect >=4.4.0 : 4.9.0 (OK) pickleshare >=0.4 : 0.7.5 (OK) psutil >=5.3 : 6.0.0 (OK) pygments >=2.0 : 2.18.0 (OK) pylint >=3.1,<4 : 3.2.5 (OK) pylint_venv >=3.0.2 : 3.0.3 (OK) pyls_spyder >=0.4.0 : 0.4.0 (OK) pylsp >=1.12.0,<1.13.0 : 1.12.0 (OK) pylsp_black >=2.0.0,<3.0.0 : 2.0.0 (OK) qdarkstyle >=3.2.0,<3.3.0 : 3.2.3 (OK) qstylizer >=0.2.2 : 0.2.3 (OK) qtawesome >=1.3.1,<1.4.0 : 1.3.1 (OK) qtconsole >=5.5.1,<5.6.0 : 5.5.2 (OK) qtpy >=2.1.0 : 2.4.1 (OK) rtree >=0.9.7 : 1.3.0 (OK) setuptools >=49.6.0 : 70.2.0 (OK) sphinx >=0.6.6 : 7.3.7 (OK) spyder_kernels >=2.5.2,<2.6.0 : 2.5.2 (OK) textdistance >=4.2.0 : 4.6.2 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog >=0.10.3 : 4.0.1 (OK) zmq >=24.0.0 : 26.0.3 (OK)

Optional:

cython >=0.21 : 3.0.10 (OK) matplotlib >=3.0.0 : 3.9.1 (OK) numpy >=1.7 : 2.0.1 (OK) pandas >=1.1.1 : 2.2.2 (OK) scipy >=0.17.0 : 1.14.0 (OK) sympy >=0.7.3 : 1.13.0 (OK)

Spyder plugins:

spyder_notebook.notebookplugin 0.5.1 : 0.5.1 (OK)

jitseniesen commented 2 months ago

Thanks for the report. That's not intentional, I did not realize that the Spyder settings change the backend in notebooks. I have to think a bit about this one.

jitseniesen commented 1 month ago

I just realized that there is an older issue with the same request, namely issue #273, so I'm closing this issue as a duplicate. Thanks for bringing this again to our attention.