nbsphinx icon indicating copy to clipboard operation
nbsphinx copied to clipboard

Deprecation warning when using nbsphinx_execute_arguments with traitlets=5.0

Open nvaytet opened this issue 4 years ago • 1 comments

With traitlets 5.0, we are getting warnings when passing parameters to the Ipython session using

nbsphinx_execute_arguments = [
"--InlineBackend.figure_formats={'svg', 'pdf'}",
"--InlineBackend.rc={'figure.dpi': 96}",
]

This also shows up in the pdf of the nbsphinx doc pages. The warning is

FutureWarning: --rc={'figure.dpi': 96} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> ... multiple times to add items to a dict.

I tried using the suggested syntax, i.e.

nbsphinx_execute_arguments = [
"--InlineBackend.rc figure.dpi=96",
]

but these parameters just get ignored.

nvaytet avatar Mar 18 '21 13:03 nvaytet

Thanks for the report!

It looks like this works:

nbsphinx_execute_arguments = [
    "--InlineBackend.figure_formats={'svg', 'pdf'}",
    "--InlineBackend.rc=figure.dpi=96",
]

But even better: I don't know since when, but right now a local configuration file ipython_kernel_config.py seems to be taken into account, see https://github.com/jupyter/nbconvert/issues/1344#issuecomment-801983364.

With that, it's not necessary anymore to use nbsphinx_execute_arguments for those settings!

ipython_kernel_config.py has the advantage that it affects both JupyterLab and nbsphinx, so there are no separate settings necessary.

mgeier avatar Mar 18 '21 14:03 mgeier