Comments (2)
from #30 (comment)
The pull request #27 adds
update_min_steps
option usage ofclick._termui_impl.ProgressBar
that is available from click 8.0. But existedsetup.cfg
contains the following restriction:click >= 6.7, !=7.0
. It breaksscancode
withclick
<8 version installation. For example: https://github.com/ARMmbed/mbed-os/pull/14981/checks?check_run_id=3470879205This pull request updates minimal
click
version in thesetup.cfg
according changes in the pull request #27.
I ran these tests:
/scancode-toolkit$ for clk_ver in 8.0.1 7.1.2 7.1.1 7.1 6.7; do pip uninstall -y click; pip install click==$clk_ver; scancode -i samples/ -n3 --json-pp - ; done
and
commoncode$ for clk_ver in 8.0.1 7.1.2 7.1.1 7.1 6.7; do pip uninstall -y click; pip install click==$clk_ver; pytest -vvs -n3; done
and all pass with this patch:
diff --git a/src/commoncode/cliutils.py b/src/commoncode/cliutils.py index 4ff8c8e..5a2a3b6 100644 --- a/src/commoncode/cliutils.py +++ b/src/commoncode/cliutils.py @@ -267,7 +267,8 @@ '[%(bar)s]' + ' ' + '%(info)s' if bar_template is None else bar_template ) - return progress_class( + + kwargs = dict( iterable=iterable, length=length, fill_char=fill_char, @@ -281,10 +282,15 @@ label=label, file=file, color=color, - update_min_steps=update_min_steps, width=width, ) + pb = progress_class([]) + if hasattr(pb, 'update_min_steps'): + kwargs['update_min_steps'] = update_min_steps + + return progress_class(**kwargs) + def fixed_width_file_name(path, max_length=25): """
The lines
+ pb = progress_class([]) + if hasattr(pb, 'update_min_steps'):
... are duck typing at its best... Not super elegant but effective nonetheless!
So with this patch we can accept all currently supported Click versions and not only > 8
from commoncode.
Fixed and released in 30.0.0
from commoncode.
Related Issues (20)
- VirtualCodebase Fails to produce the codebase upon scanning file Resources having fingerprint attribute HOT 1
- VirtualCodebase Fails to produce the codebase upon scanning file whose paths have a prefix of "/" HOT 1
- commoncode breaks with click 8.0.1 HOT 4
- VirtualCodebase Fails to produce the codebase upon scanning `Codebases` having different attributes in `Files` and `Directories` HOT 1
- VirtualCodebase recursion error HOT 1
- The root of the problem is the root: How to get a root at all times in a codebase (or no root at all) HOT 5
- Refactor how strip_root argument works for Codebase
- Rethinking the relationship between Codebases and Resources
- Test failure with Python 3.10 HOT 3
- Add warnings field to codebase headers HOT 1
- Implement `for_packages_append` on `Resource` HOT 3
- Issue importing a scancode.io JSON results into VirtualCodebase HOT 1
- codebase_attributes are ignored when creating a VirtualCodebase from a scan HOT 1
- Failure of tests/test_paths.py::TestPortablePath::test_safe_path_posix_style_chinese_char HOT 5
- VirtualCodebase walk issue HOT 1
- VirtualCodebase fails with Python 3.9 HOT 1
- Testing in GitHub CI HOT 3
- datetime.datetime.utcfromtimestamp is deprecated in Python 3.12
- Drop support for Python 2 code HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commoncode.