I’ve recently put some time into developing a new extension for JupyterLab and Jupyter Notebook. That extension, jupyter-ruff does what it says on the tin, and can be used to format Python code in Jupyter notebooks with Ruff. It is currently available on PyPi and NPM.
Think nb_black but more modern and maintained, or jupyterlab_code_formatter but much easier to set up. You simply have to install the extension, no extra configuration required. It will then allow you to format Python code using menus, keyboard shortcuts, automatically format cells on execution, or format cells when a notebook is saved. Optionally, it can also sort your imports using an isort compatible algorithm.
On the more technical side, it actually uses a WASM build of Ruff internally, so it is a pure client-side extension. This may ease installation in some cases. Still, it will read and discover your local Ruff configuration.
In any case, I would love to hear your feedback and maybe see some people other than me start using the project!