Black: 20.8b0 fails with `__init__() got an unexpected keyword argument 'hidden'` on Click older than 7.0

Created on 26 Aug 2020  路  14Comments  路  Source: psf/black

Describe the bug

When I run black version 20.8b0 in Github Actions, it fails with this traceback:

Traceback (most recent call last):
  File "/usr/local/bin/black", line 7, in <module>
    from black import patched_main
  File "/usr/local/lib/python3.6/dist-packages/black/__init__.py", line 507, in <module>
    ) -> None:
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 170, in decorator
    _param_memo(f, OptionClass(param_decls, **attrs))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1460, in __init__
    Parameter.__init__(self, param_decls, type=type, **attrs)
TypeError: __init__() got an unexpected keyword argument 'hidden'

To Reproduce

  1. sudo pip3 install black
  2. black --check .
  3. See error

Expected behavior

Black would display any files that failed formatting check

Environment (please complete the following information):

  • Version: 20.8b0
  • OS and Python version: Default Github Actions image (Ubuntu 18.04/Python 3.6)
bug

Most helpful comment

We'll release a follow-up. In the mean time please pip3 install -U click to fix this.

All 14 comments

I'm not entirely sure, but it looks like the error is coming from this line:

https://github.com/psf/black/blob/9270a10f6f59f069eb14ffba0c75f58e5895b27c/src/black/__init__.py#L384

We'll release a follow-up. In the mean time please pip3 install -U click to fix this.

Looks like the option was new in Click 7.0. I'll send a PR to use that as the minimum requirement for Black.

+1 I also ran into sudden failures in GitHub actions when they pulled 20.8b0. I pinned the install to 19.10b0 to workaround.

@brysontyrrell, try pinning Click to >=7.1.2 instead and see if that works for you.

Released a hotfix 20.8b1 that addresses this. Please confirm.

Working for me. Thanks!

Still not working for me.

Oh no! 馃挜 馃挃 馃挜
14 files would be reformatted, 37 files would be left unchanged.
##[error]Process completed with exit code 1.

I re-ran and it pulled black 20.8b1 and click 7.1.2. Same versions of the packages locally don't encounter this. Maybe this is actually related to #1629 ?

That looks like a different problem @brysontyrrell. I'm guessing you're running black --check and it would make formatting changes to your files (which is expected), so it exits with 1

@brysontyrrell No, this is not related to #1629. The message you pasted tells you what's going on. This is a new version of an auto-formatter. The new version changed how it formats files. Commit the changes and you're good to go.

@ambv Thanks for clarifying. I had a caching issue locally that was causing 19.10 to be reinstalled and I wasn't catching it.

@ambv The hotfix does not solve the issue for us. See https://travis-ci.org/github/spulec/moto/jobs/721404011

@bblommers The logs on that Travis job tell you what's wrong. Namely the lines in the sdist step:

ERROR: black 20.8b1 has requirement click>=7.1.2, but you'll have click 6.7 which is incompatible.
ERROR: black 20.8b1 has requirement regex>=2020.1.8, but you'll have regex 2019.11.1 which is incompatible.

And why are you getting those? Because you request them explicitly here:
https://github.com/spulec/moto/blob/master/requirements-dev.txt#L16

(regex is on line 4 here)

@ambv Well, that's awkward. I completely overlooked those lines! Thanks for the response

Was this page helpful?
1 / 5 - 1 ratings

Related issues

dgingrich picture dgingrich  路  36Comments

Kristinita picture Kristinita  路  28Comments

devxpy picture devxpy  路  70Comments

rouge8 picture rouge8  路  20Comments

underyx picture underyx  路  22Comments