Repository navigation
Description
Update:
The issue is caused because commoncode does not properly set the supported range for its dependency on click, as can be seen here:
Line 45 in aba7c1b
| click >= 6.7, !=7.0 |
The package click has changed its ProgressBar implementation in commit pallets/click@fcd8503 which is part of the 8.2.0 release.
As such when installing commoncode, the most recent version of click is installed, which happens to be incompatible. The commoncode attempts to access is_hidden on EnhancedProgressBar which inherits from click's ProgressBar. As the attribute has been renamed from is_hidden to hidden this fails.
Running scancode-toolkit on Windows throws an exception when not using the --quiet option. This is particularly strange, because I am fairly certain that the same version of scancode-toolkit worked just a couple of days ago.
Using:
- scancode-toolkit 32.3.3
- commoncode 32.2.1
- click 8.2.0
Setup plugins...
Collect file inventory...
Scan files for: info, licenses, copyrights, emails, urls with 4 process(es)...
Removing temporary files...done.
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\user\01-data\10-git\test\venv\Scripts\scancode.exe\__main__.py", line 7, in <module>
sys.exit(scancode())
~~~~~~~~^^
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\core.py", line 1442, in __call__
return self.main(*args, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\commoncode\cliutils.py", line 73, in main
return click.Command.main(
~~~~~~~~~~~~~~~~~~^
self,
^^^^^
...<4 lines>...
**extra,
^^^^^^^^
)
^
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\core.py", line 1363, in main
rv = self.invoke(ctx)
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\core.py", line 1226, in invoke
return ctx.invoke(self.callback, **ctx.params)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\core.py", line 794, in invoke
return callback(*args, **kwargs)
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\decorators.py", line 34, in new_func
return f(get_current_context(), *args, **kwargs)
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\scancode\cli.py", line 487, in scancode
success, _results = run_scan(
~~~~~~~~^
input=input,
^^^^^^^^^^^^
...<20 lines>...
**kwargs
^^^^^^^^
)
^
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\scancode\cli.py", line 944, in run_scan
scan_success = run_scanners(
stage='scan',
...<8 lines>...
echo_func=echo_func,
)
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\scancode\cli.py", line 1186, in run_scanners
scan_success = scan_codebase(
codebase, scanners, processes, timeout,
with_timing=timing, progress_manager=progress_manager)
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\scancode\cli.py", line 1285, in scan_codebase
scans.__enter__()
~~~~~~~~~~~~~~~^^
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\click\_termui_impl.py", line 118, in __enter__
self.render_progress()
~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\user\01-data\10-git\test\venv\Lib\site-packages\commoncode\cliutils.py", line 199, in render_progress
if not self.is_hidden:
^^^^^^^^^^^^^^
AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
Activity
rogu-beta commentedon May 15, 2025
It seems requirements.txt indicates that click==8.1.3 should be used, which might explain the issue (https://github.com/aboutcode-org/commoncode/blob/v32.2.1/requirements.txt). However, that is not what is being installed with scancode-toolkit for some reason. The version of scancode-toolkit should require click==8.1.7 though (https://github.com/aboutcode-org/scancode-toolkit/blob/e0db4dd8725f756e776a2118be3f400217e5c34d/requirements.txt#L11)
rogu-beta commentedon May 15, 2025
It appears that this has changed in click in the following commit pallets/click@fcd8503
This might not be a bug in commoncode after all, but there is some package that despite being pinned in version still pulls a more recent version of click than it should.rogu-beta commentedon May 15, 2025
I can confirm that installing commoncode, results in click 8.2.0 being installed due to range defined in
setup.cfg:commoncode/setup.cfg
Line 45 in aba7c1b
AyanSinhaMahapatra commentedon Jun 11, 2025
Thanks @ghsa-retrieval for the report, this should be fixed with aboutcode-org/scancode-toolkit#4427 (after it is merged and released) and the new https://github.com/aboutcode-org/commoncode/releases/tag/v32.3.0, and this is also tracked in aboutcode-org/scancode-toolkit#4369
So closing this as this is fixed in commoncode and this is tracked in SCTK with a duplicate issue.