Skip to content

Commit a3adbfa

Browse files
authored
Merge pull request #92 from aboutcode-org/fix-click-compat
Fix click compatibility and update python support
2 parents 1dd162b + b404b0b commit a3adbfa

File tree

12 files changed

+62
-37
lines changed

12 files changed

+62
-37
lines changed

.github/workflows/pypi-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ jobs:
7171
needs:
7272
- create-gh-release
7373
runs-on: ubuntu-24.04
74+
environment: pypi-publish
75+
permissions:
76+
id-token: write
7477

7578
steps:
7679
- name: Download built archives

CHANGELOG.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
Release notes
22
=============
33

4-
Version 32.3.0 - (2025-03-06)
4+
Version 32.4.0 - (2025-10-22)
5+
-----------------------------
6+
7+
- Fix ``click`` 8.3.0 compatibililty issues.
8+
https://github.com/aboutcode-org/commoncode/pull/92
9+
10+
- Drop python 3.9 support and add python 3.14
11+
https://github.com/aboutcode-org/commoncode/pull/92
12+
13+
- Handle paths with non-utf-8 bytes
14+
https://github.com/aboutcode-org/commoncode/pull/91
15+
16+
Version 32.3.0 - (2025-06-11)
517
-----------------------------
618

719
- Fix ``click`` compatibililty issues.

azure-pipelines.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,47 +13,47 @@ jobs:
1313
parameters:
1414
job_name: ubuntu22_cpython
1515
image_name: ubuntu-22.04
16-
python_versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1717
test_suites:
1818
all: venv/bin/pytest -n 2 -vvs
1919

2020
- template: etc/ci/azure-posix.yml
2121
parameters:
2222
job_name: ubuntu24_cpython
2323
image_name: ubuntu-24.04
24-
python_versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
24+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
2525
test_suites:
2626
all: venv/bin/pytest -n 2 -vvs
2727

2828
- template: etc/ci/azure-posix.yml
2929
parameters:
3030
job_name: macos13_cpython
3131
image_name: macOS-13
32-
python_versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
32+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
3333
test_suites:
3434
all: venv/bin/pytest -n 2 -vvs
3535

3636
- template: etc/ci/azure-posix.yml
3737
parameters:
3838
job_name: macos14_cpython
3939
image_name: macOS-14
40-
python_versions: ['3.9', '3.10', '3.11', '3.12', '3.13']
40+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
4141
test_suites:
4242
all: venv/bin/pytest -n 2 -vvs
4343

4444
- template: etc/ci/azure-win.yml
4545
parameters:
4646
job_name: win2025_cpython
4747
image_name: windows-2025
48-
python_versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
48+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
4949
test_suites:
5050
all: venv\Scripts\pytest -n 2 -vvs
5151

5252
- template: etc/ci/azure-win.yml
5353
parameters:
5454
job_name: win2022_cpython
5555
image_name: windows-2022
56-
python_versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
56+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
5757
test_suites:
5858
all: venv\Scripts\pytest -n 2 -vvs
5959

@@ -65,10 +65,10 @@ jobs:
6565
parameters:
6666
job_name: ubuntu24_test_all_supported_click_versions
6767
image_name: ubuntu-24.04
68-
python_versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
68+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
6969
test_suites:
7070
click_versions: |
71-
for clk_ver in 8.2.0 8.2.1 8.1.8 8.1.7 8.1.6 8.1.5 8.1.4 8.1.3 8.1.2 8.1.1 8.1.0 8.0.4 8.0.2 8.0.3 8.0.1 7.1.2 7.1.1 7.1 6.7;
71+
for clk_ver in 8.3.0 8.2.0 8.2.1 8.1.8 8.1.7 8.1.6 8.1.5 8.1.4 8.1.3 8.1.2 8.1.1 8.1.0 8.0.4 8.0.2 8.0.3 8.0.1 7.1.2 7.1.1 7.1 6.7;
7272
do
7373
venv/bin/pip install click==$clk_ver;
7474
venv/bin/pytest -vvs tests/test_cliutils_progressbar.py;
@@ -82,7 +82,7 @@ jobs:
8282
parameters:
8383
job_name: ubuntu24_cpython_latest_from_pip
8484
image_name: ubuntu-24.04
85-
python_versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
85+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
8686
test_suites:
8787
all: |
8888
venv/bin/pip install --upgrade-strategy eager --force-reinstall --upgrade -e .
@@ -93,7 +93,7 @@ jobs:
9393
parameters:
9494
job_name: win2022_cpython_latest_from_pip
9595
image_name: windows-2022
96-
python_versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
96+
python_versions: ["3.10", "3.11", "3.12", "3.13", "3.14"]
9797
test_suites:
9898
all: |
9999
venv\Scripts\pip install --upgrade-strategy eager --force-reinstall --upgrade -e .

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ create_virtualenv() {
110110
fi
111111

112112
$PYTHON_EXECUTABLE "$VIRTUALENV_PYZ" \
113-
--wheel embed --pip embed --setuptools embed \
113+
--pip embed --setuptools embed \
114114
--seeder pip \
115115
--never-download \
116116
--no-periodic-update \

configure.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if not exist "%CFG_BIN_DIR%\python.exe" (
110110

111111
if exist "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" (
112112
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ^
113-
--wheel embed --pip embed --setuptools embed ^
113+
--pip embed --setuptools embed ^
114114
--seeder pip ^
115115
--never-download ^
116116
--no-periodic-update ^
@@ -126,7 +126,7 @@ if not exist "%CFG_BIN_DIR%\python.exe" (
126126
)
127127
)
128128
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" ^
129-
--wheel embed --pip embed --setuptools embed ^
129+
--pip embed --setuptools embed ^
130130
--seeder pip ^
131131
--never-download ^
132132
--no-periodic-update ^

etc/scripts/utils_requirements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def split_req(req):
153153
if not req:
154154
raise ValueError("req is required")
155155
# do not allow multiple constraints and tags
156-
if not any(c in req for c in ",;"):
156+
if any(c in req for c in ",;"):
157157
raise Exception(f"complex requirements with : or ; not supported: {req}")
158158
req = "".join(req.split())
159159
if not any(c in req for c in comparators):

requirements-dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ aboutcode-toolkit==11.1.1
22
black==23.1.0
33
bleach==6.0.0
44
boolean.py==4.0
5-
cffi==1.15.1
5+
cffi==2.0.0
66
cryptography==39.0.1
77
docutils==0.19
88
et-xmlfile==1.1.0
@@ -27,11 +27,11 @@ packaging==23.0
2727
pathspec==0.11.0
2828
pkginfo==1.9.6
2929
platformdirs==3.0.0
30-
pluggy==1.0.0
30+
pluggy==1.6.0
3131
pycodestyle==2.13.0
3232
pycparser==2.21
3333
pygments==2.14.0
34-
pytest==7.2.1
34+
pytest==8.4.2
3535
pytest-xdist==3.2.0
3636
readme-renderer==37.3
3737
requests-toolbelt==0.10.1

requirements.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
attrs==25.3.0
2-
beautifulsoup4==4.13.4
3-
certifi==2025.4.26
1+
attrs==25.4.0
2+
beautifulsoup4==4.14.2
3+
certifi==2025.10.5
44
chardet==5.2.0
5-
charset-normalizer==3.4.2
6-
click==8.2.1;python_version>='3.10'
7-
click==8.1.8;python_version<'3.10'
5+
charset-normalizer==3.4.4
6+
click==8.3.0
87
idna==3.10
98
pip==25.1.1
109
PyYAML==6.0.2
1110
requests==2.32.2
1211
saneyaml==0.6.1
13-
setuptools==80.3.1
14-
soupsieve==2.7
12+
setuptools==80.9.0
13+
soupsieve==2.8
1514
text-unidecode==1.3
16-
typing_extensions==4.13.2
17-
urllib3==1.26.20
15+
typing_extensions==4.15.0
16+
urllib3==2.5.0
1817
wheel==0.38.4

setup.cfg

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ license_files =
3131
commoncode.ABOUT
3232

3333
[options]
34-
python_requires = >=3.9
34+
python_requires = >=3.10
3535
package_dir =
3636
=src
3737
packages = find:
@@ -44,8 +44,7 @@ install_requires =
4444
attrs >= 18.1,!=20.1.0;python_version<'3.11'
4545
attrs >= 22.1.0;python_version>='3.11'
4646
Beautifulsoup4[chardet] >= 4.13.0
47-
click >= 6.7, !=7.0;python_version<'3.10'
48-
click >= 8.2.0;python_version>='3.10'
47+
click >= 8.3.0
4948
requests[use_chardet_on_py3] >= 2.7.0
5049
saneyaml >= 0.5.2
5150
text_unidecode >= 1.0

src/commoncode/cliutils.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@
2222
# Tracing flags
2323
TRACE = False
2424

25+
try:
26+
# Introduced in click 8.3.0 to have a sentinel value
27+
# (https://peps.python.org/pep-0661/) for flag values
28+
# and default values instead of None to differentiate
29+
# between explicitly setting a `None` value and
30+
# not setting and value.
31+
# See https://github.com/pallets/click/pull/3030 and
32+
# https://github.com/pallets/click/releases/tag/8.3.0
33+
from click.core import UNSET
34+
except ImportError:
35+
# to maintain compatibility with click < 8.3.0
36+
UNSET = None
37+
2538

2639
def logger_debug(*args):
2740
pass
@@ -165,7 +178,7 @@ def format_options(self, ctx, formatter):
165178

166179

167180
class CompatProgressBar(ProgressBar):
168-
# TODO Remove when dropping support for Python 3.9 or Click 8.1.
181+
# TODO Remove when dropping support for Click 8.1.
169182
@property
170183
def is_hidden(self) -> bool:
171184
return self.hidden
@@ -188,7 +201,7 @@ def make_step(self, n_steps):
188201
# overriden and copied from Click to work around Click woes for
189202
# https://github.com/aboutcode-org/scancode-toolkit/issues/2583
190203
def generator(self):
191-
if self.is_hidden:
204+
if self.hidden:
192205
yield from self.iter
193206
else:
194207
for rv in self.iter:
@@ -207,7 +220,7 @@ class EnhancedProgressBar(DebuggedProgressBar):
207220
"""
208221

209222
def render_progress(self):
210-
if not self.is_hidden:
223+
if not self.hidden:
211224
return super(EnhancedProgressBar, self).render_progress()
212225

213226

@@ -228,7 +241,7 @@ class ProgressLogger(CompatProgressBar):
228241

229242
def __init__(self, *args, **kwargs):
230243
super(ProgressLogger, self).__init__(*args, **kwargs)
231-
self.is_hidden = False
244+
self.hidden = False
232245

233246
def render_progress(self):
234247
line = self.format_progress_line()
@@ -429,7 +442,7 @@ def __init__(
429442
confirmation_prompt=False,
430443
hide_input=False,
431444
is_flag=None,
432-
flag_value=None,
445+
flag_value=UNSET,
433446
multiple=False,
434447
count=False,
435448
allow_from_autoenv=True,

0 commit comments

Comments
 (0)