Skip to content

Instantly share code, notes, and snippets.

@jbwhit
Last active April 23, 2024 14:25
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbwhit/eecdd1cac2756df85ad165f437445b0b to your computer and use it in GitHub Desktop.
Save jbwhit/eecdd1cac2756df85ad165f437445b0b to your computer and use it in GitHub Desktop.
Steps to use `ruff` in JupyterLab with the `jupyterlab_code_formatter` plugin.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dlimpid
Copy link

dlimpid commented Jan 25, 2024

Thank you very much for the great guide! A problem for me was that cells containing non-ascii unicode characters were not formatted. I could fix this by adding encoding="utf-8" in the subprocess.run() call.

@jbwhit
Copy link
Author

jbwhit commented Jan 25, 2024

Thank you for the comment! I'm thinking of revisiting this and seeing if I can make a PR to the extension itself. I'll add your change.

@Gr1nse
Copy link

Gr1nse commented Mar 26, 2024

Hi!
Nice Guide!
in this Guide you just use the formater right?
Do you know how to get the ruff linter to work in jupyterlab?

@nicornk
Copy link

nicornk commented Apr 19, 2024

I had to add the import "from typing import List" to the config file snippet. @jbwhit

@jbwhit
Copy link
Author

jbwhit commented Apr 19, 2024

Thanksk @nicornk -- I've added that to my snippet!

@aliavni
Copy link

aliavni commented Apr 23, 2024

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment