Formatter black is not working on my VSCode…but why?

Update 2023-09-15: Now VSCode has a Microsoft oficial Black Formatter extension. It will probably solve your problems. Original answer: I use Black from inside VSCode and it rocks. It frees mental cycles that you would spend deciding how to format your code. It’s best to use it from your favorite editor. Just run from the … Read more

ImportError: cannot import name ‘_unicodefun’ from ‘click’

This has been fixed by Black 22.3.0. Versions before that won’t work with click 8.1.0. Incompatible with click 8.1.0 (ImportError: cannot import name ‘_unicodefun’ from ‘click’) #2964 E.g.: black.yml python-version: 3.8 – name: install black run: | – pip install black==20.8b1 + pip install black==22.3.0 – name: run black run: | black . –check –line-length … Read more

Exclude some files on running black using pre-commit

This issue on the black issue tracker outlines your particular problem pre-commit finds all the python files, then applies pre-commit‘s exclusion, and then passes that list of files to the underlying tools (in this case black) black currently (at the time of writing) will format all files listed on the command line — independent of … Read more

Black does not support “Format Selection” command

In my situation (select black as the Python Formatting Provider in VS Code Settings), I encountered this warning everytime when I pasting some text into the editor. And the official documentation of VS Code has a solution specifically for it: When using the black formatter, VS Code issues the following warning when pasting source code … Read more

black as pre-commit hook always fails my commits

(author of pre-commit here) the framework intentionally does not provide a way to auto-commit modifications. Here’s a few issues which have asked for such: pre-commit/pre-commit#806 pre-commit/pre-commit#747 A comment from one of those issues: pre-commit itself will never touch the staging area. These are good ways to silently break commits. In my mind this is one … Read more

Code formatter like nb_black for google colab

I don’t think there’s an extension directly in Colab. What you could do, though, is to download your notebook, run pip install -U nbqa nbqa black notebook.ipynb and then reupload your (now formatted) notebook to Colab disclaimer: I’m the author of nbQA UPDATE: as of version 21.8b0, black runs directly on notebooks, no third-party tool … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)