To the Jupyter config and back

Tags

  • py

Configure Jupyter from ~/.jupyter/jupyter_notebook_config.py. Backend options can be found in jupyter notebook --help.

As of Nov 10, 2020 frontend config is still WIP. You can change things in some weird way via front-end JavaScript, though.

var cell = Jupyter.notebook.get_selected_cell();
var config = cell.config;
var patch = {
  CodeCell : {
    cm_config: {indentUnit:2}
  }
}
config.update(patch)

Jupyter uses the CodeMirror front-end to render Python (NB, also check out the various hooks). Under the hood, Jupyter will persist the preferred configuration settings in ~/.jupyter/nbconfig/<section>.json, where section is not formalized but can be at least some of common, notebook, tree, editor. E.g. my current notebook.json:

{
  "CodeCell": {
    "cm_config": {
      "indentUnit": 2,
      "tabSize": 2,
      "indentWithTabs": false
    }
  }
}