databrickslabs / jupyterlab-integration

DEPRECATED: Integrating Jupyter with Databricks via SSH
Other
71 stars 12 forks source link

A bug with incorrect jupyter_notebook_config.py overwriting with multiline values (e.g. dicts) #20

Closed apulich-exos closed 3 years ago

apulich-exos commented 3 years ago

If there are some multiline dicts in jupyter_notebook_config.py like

c.NotebookApp.tornado_settings={
  'headers': {
    'SOME_HEADER': 'SOME_VALUE'
  }
}

then databrickslabs_jupyterlab.local.write_config splits the first line by "=" which results in

['c.NotebookApp.tornado_settings', '{']

Next lines are just simply ignored as there is no "=" symbol there. As a result, the correct c.NotebookApp.tornado_settings settings are overwritten by c.NotebookApp.tornado_settings={ which simply breaks the config as now we have only an opening brace.

A workaround on this is just to flatten the config lines into one, but it can make the config unreadable if there are lots of lines. So maybe there is some sense to change write_config func so it can handle such cases.

I guess I can fix it and create a pull-request