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
Running from the command-line still has issues with Click #566
Comments
@wooters, your conclusion is absolutely right. We should be patching Click in entry_points, too. Please create a PR with your |
Will do. Thanks. |
This was fixed a good while back. |
This issue seems to be back with the recent v8.0.0 release of the click library, automatically pulled with the current constraint. Here is a reproducer and possible fix with a constraint on docker run -it --rm ubuntu:18.04 bash -c "set -x; apt update && apt install -y python3-pip && pip3 install --upgrade black && black --version; LANG=C.UTF-8 black --version; pip3 install --upgrade 'click<8.0.0' && black --version" Ubuntu 18.04 repos ship |
Luckily this only affects Python 3.6 users so an increasingly marginal subset. We will fix our workaround to work with Click 8.0. In the meantime your workaround to pin to Click<8.0 works. You can also upgrade to Python 3.7+. |
I've just run into the same problem with PyCharm and Click that was reported in issue #277:
I think there is still a problem and I believe the problem may be that the generated command line script only calls the
main()
function fromblack.py
(see the entry point on line 60 insetup.py
:black=black:main
).So, after running
pip install black
, the generated command-line script looks like this:If you try to use this script to invoke black (e.g. as the command for an "external tool" in PyCharm), the
patch_click()
function won't be called and you'll get the original error reported in #277.To verify, I edited this script by hand, like so:
This appears to work, but is probably is not the best way to permanently fix the issue.
One possible fix (although I don't claim that this is the best approach, especially since I'm not sure how it might interact with
blackd
), would be to create a newmain
that can be used as the entry point for the cli script. Maybe something like this at the end ofblack.py
:along with this change in
setup.py
:Anyway, as I said, I don't know if this is a good solution. I mostly wanted to post it as a means of clarifying what I think the problem is.
Thank you for your time and for creating this awesome tool!
The text was updated successfully, but these errors were encountered: