thebe icon indicating copy to clipboard operation
thebe copied to clipboard

Consider moving serverSettings out of kernelOptions

Open akhmerov opened this issue 5 years ago • 5 comments

I think the nesting of serverSettings and kernelOptions seems counter-productive now.

kernelOptions mostly correspond to the kernel metadata on the jupyter side. In a multipage site, kernelOptions may be different on different pages (language and path may vary).

At the same time serverSettings, is likely to be always the same, and it plays a similar role to binderOptions.

Therefore I propose to move serverSettings out of into a top level key out of kernelOptions.

akhmerov avatar May 01 '21 20:05 akhmerov

Additionally, if a specific server is configured, perhaps it should have priority over binder, and not vice versa.

akhmerov avatar May 01 '21 20:05 akhmerov

What's the downside of having them nested? Don't the options get set per page anyway?

choldgraf avatar May 01 '21 22:05 choldgraf

E.g. in sphinx-thebe the per-page code that is supposed to configure the kernel options now needs to ensure that it correctly preserves global server options.

akhmerov avatar May 02 '21 00:05 akhmerov

Sorry that I am not following. Could you give a more specific example of why that's a problem? Isn't that just updating a_dict['somekey'] and making sure you don't also update a_dict['someotherkey']?

choldgraf avatar May 02 '21 01:05 choldgraf

I've stumbled upon this by working on https://github.com/executablebooks/sphinx-thebe/pull/25/

The difference is roughly speaking between these two implementations:

default_config = get_config()
kernel_options = get_kernel_options()
if "kernelOptions" in default_config and "serverSettings" in default_config["kernelOptions"]:
    kernel_options["serverSettings"] = default_config["kernelOptions"]["serverSettings"]
default_config["kernelOptions"] = kernel_options

and

default_config = get_config()
default_config["kernelOptions"] = get_kernel_options()

akhmerov avatar May 02 '21 09:05 akhmerov