-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
black being pinned to an older version causes a crash #716
Comments
Okay, I've made a mistake. It's not because of |
Hi @chamilad , Thanks for the issue - this only affects local nbQA development, right? For users of the library, black isn't pinned (nor is it a required dependency) |
Hi @MarcoGorelli, Sorry, my issue description is wrong. It affects the library use, at least in my case. I'm guessing it's because of how precommit config works, because I even tried installing Black and Click with pinned latest versions before installing nbqa-black library without success. I couldn't dig deep into this, but I'm guessing precommit uses some kind of venv setup with the precommit config versions of the dependencies installed. The error is reproduced in a Github pipeline, so I couldn't get into the file system to investigate in depth. |
Can you show your precommit config file please? |
@chamilad black fixed this issue by now. Lines 8 to 15 in b77ee14
But pre-commit caches the venvs it uses to run the hooks based on the values in your config.Your problem most likely is that the cached venv uses a broken combination of back and click (also had this issue lately).You could just pin the version of black==22.3.0 in the additional_dependencies section of your pre-commit-config.yaml , which would create a new venv due to the changed config.Alternatively, if black isn't pinned in your config you can run pre-commit clean which will delete all cached venvs.
@MarcoGorelli The possibility to create such a broken venv with the default |
Hi @MarcoGorelli , @s-weigand , Yeah, I don't know how to say this without sounding stupid, but you're right. I have jumped the gun on the dependency. Turns out our Workflow copies over a precommit config from a different repo, which had Thanks for your support in getting this cleared! Should I keep the issue open as it's pinned? If not, please close it. |
No worries, thanks for the report! I'll close then but will keep pinned for a bit |
Hi, run into an issue while testing I was trying to run this tools against a notebook I have, my setup is a windows laptop with docker, and I pulled Then, created a virtual environment and installed nbqa as:
In line 3 above, nbqa complained that the "black" command was not found. I thought those tools described in https://nbqa.readthedocs.io/en/latest/examples.html came pre-packaged with nbqa :), so I installed black with pip. Then trying to run it, gave me this error (the traces are shortened):
And my black version was:
UPDATE: my bad, this error is related to Python 3.6. https://stackoverflow.com/a/53209196 explains the reason. Using a python:3.7 as the container image, got the thing working:
|
There was a breaking change recently in the
click
library which is a dependency inblack
.black
has updated the dependency version and released a new version, however becauseblack
is pinned to an older version, this fix isn't getting propagated. For the moment, we can workaround this by pinningclick
to an older version, but I thinknbqa-black
itself can fix this by moving to the newest black version.I checked the commit that introduced the version pin, but I couldn't figure out the reason for doing so.
Refer to the upstream issue for more details.
The text was updated successfully, but these errors were encountered: