JupyterLab 格式化代码插件
环境要求
- Python 3.6+
- JupyterLab >= 3.0.0
安装相关插件
jupyterlab_code_formatter
是一个JupyterLab插件,用于方便代码格式化器的调用。
$ pip install jupyterlab_code_formatter black isort
启动JupyterLab
$ jupyter lab
格式化代码
启动JupyterLab之后,页面上会有一个按钮,如下图所示。如果出现此按钮出现安装格式化代码插件
成功。
点击按钮格式化代码
点击页面上箭头所指的按钮对代码进行格式化。
右键格式化代码
在页面上任意空白位置右键,出现弹窗,点击Format cell
对代码进行格式化。