Skip to content

Commit aa3710d

Browse files
committed
apply fixes, fmt, lint, test
1 parent 2a1cbc6 commit aa3710d

9 files changed

Lines changed: 79 additions & 66 deletions

File tree

CHANGELOG.md

Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
All major and minor version changes will be documented in this file. Details of
44
patch-level version changes can be found in [commit messages](../../commits/master).
55

6-
## 2025.1.1 - 2025/10/03
6+
## 2026.0.1
77

88
- Fixed GNU Library (old alternative license name) not being recognized as LGPL 2.0.
99
- Added UPL-1.0 license to license types and updated the matrix (similar to MIT).
10+
- Fixed #145 (Bugfix load the show_only_failing from the config), thank you @pgjones
11+
- Feat #143 (Use ThreadPool Executor to fetch packages concurrently), thanks @atom-andrew
12+
- Fixed #141 (Support EPL-1.0 and EPL-2.0 license strings), thanks @MattTheCuber
13+
- Fixed #138 (running licensecheck without any config files), thanks @MattTheCuber
14+
- Fixed #130 (GNU Library being not recognized, added UPL-1.0), thanks @robertuss12
1015

1116
## 2025.1.0 - 2025/03/26
1217

@@ -17,9 +22,9 @@ patch-level version changes can be found in [commit messages](../../commits/mast
1722

1823
- update the cli interface to remove some confusing functionality
1924
- refactor the library / code qa improvements
20-
- Allow for alias of classifier in setup.cfg, thanks https://github.com/ericwb: #106
25+
- Allow for alias of classifier in setup.cfg, thanks <https://github.com/ericwb>: #106
2126
- Add support for SPDX license expression metadata after PEP 639: #107
22-
- Add use regex/glob pattern to ignore multiple packages, thanks https://github.com/JulianKimmig: #108
27+
- Add use regex/glob pattern to ignore multiple packages, thanks <https://github.com/JulianKimmig>: #108
2328
- Prioritise ['project'] table over ['tool.poetry'] in pyproject.toml: #104
2429
- Add option to show only failing packages: #98
2530

@@ -30,15 +35,15 @@ patch-level version changes can be found in [commit messages](../../commits/mast
3035

3136
## 2024.2 - 2024/04/04
3237

33-
- Add html output using `markdown` lib https://github.com/FHPythonUtils/LicenseCheck/issues/77
38+
- Add html output using `markdown` lib <https://github.com/FHPythonUtils/LicenseCheck/issues/77>
3439

3540
## 2024.1.5 - 2024/04/04
3641

3742
- fix critical TypeError: can only join an iterable
3843

3944
## 2024.1.4 - 2024/03/30
4045

41-
- fix critical https://github.com/FHPythonUtils/LicenseCheck/issues/75 where importlib.metadata.PackageMetadata.json does not exist in Python < 3.10
46+
- fix critical <https://github.com/FHPythonUtils/LicenseCheck/issues/75> where importlib.metadata.PackageMetadata.json does not exist in Python < 3.10
4247

4348
```txt
4449
py311: OK (7.55=setup[5.89]+cmd[1.66] seconds)
@@ -50,7 +55,7 @@ patch-level version changes can be found in [commit messages](../../commits/mast
5055

5156
## 2024.1.3 - 2024/03/20
5257

53-
- fix https://github.com/FHPythonUtils/LicenseCheck/issues/74
58+
- fix <https://github.com/FHPythonUtils/LicenseCheck/issues/74>
5459
- update tests (as env has changed, ideally we'd mock more than we do atm)
5560
- linting fixes
5661

@@ -73,45 +78,45 @@ patch-level version changes can be found in [commit messages](../../commits/mast
7378
## 2024 - 2024/01/27
7479

7580
- code improvements
76-
- users can now specify a license from the command line with `--license` https://github.com/FHPythonUtils/LicenseCheck/issues/69
81+
- users can now specify a license from the command line with `--license` <https://github.com/FHPythonUtils/LicenseCheck/issues/69>
7782

7883
## 2024 - 2024/01/07
7984

8085
- update dependencies
8186

8287
## 2023.5.2 - 2023/12/01
8388

84-
- fix: crash when a namespace doesn't exist https://github.com/FHPythonUtils/LicenseCheck/issues/65
85-
- fix: add support for double quotes in extras https://github.com/FHPythonUtils/LicenseCheck/pull/64,
86-
thanks https://github.com/arunkumarpandian
89+
- fix: crash when a namespace doesn't exist <https://github.com/FHPythonUtils/LicenseCheck/issues/65>
90+
- fix: add support for double quotes in extras <https://github.com/FHPythonUtils/LicenseCheck/pull/64>,
91+
thanks <https://github.com/arunkumarpandian>
8792

8893
## 2023.5.1 - 2023/09/21
8994

90-
- Fix optional extras from dependencies being included by default. Thank you https://github.com/arunkumarpandian!
91-
- Dynamically get version from package metadata. Thank you https://github.com/emesar
95+
- Fix optional extras from dependencies being included by default. Thank you <https://github.com/arunkumarpandian>!
96+
- Dynamically get version from package metadata. Thank you <https://github.com/emesar>
9297
- Bump version of rich
9398

9499
## 2023.4.3 - 2023/08/30
95100

96-
- Add a new flag `--skip-dependencies` which will exclude from the processing a list of the current project dependencies. Suitable for private dependencies which are only available on a private registry and not on PyPi. Thank you https://github.com/Azraeht :)
101+
- Add a new flag `--skip-dependencies` which will exclude from the processing a list of the current project dependencies. Suitable for private dependencies which are only available on a private registry and not on PyPi. Thank you <https://github.com/Azraeht> :)
97102

98103
## 2023.4.2 - 2023/08/25
99104

100-
- Fixed Bug: handle missing urls for a pypi package https://github.com/FHPythonUtils/LicenseCheck/issues/57. Thank you https://github.com/Azraeht!
105+
- Fixed Bug: handle missing urls for a pypi package <https://github.com/FHPythonUtils/LicenseCheck/issues/57>. Thank you <https://github.com/Azraeht>!
101106

102107
## 2023.4.1 - 2023/08/20
103108

104-
- Fixed Bug: https://github.com/FHPythonUtils/LicenseCheck/issues/55
109+
- Fixed Bug: <https://github.com/FHPythonUtils/LicenseCheck/issues/55>
105110

106111
## 2023.4 - 2023/08/20
107112

108113
- Refactor and code enhancements
109-
- Fixed Bug: fix behaviour of dependency discovery for 'extras', thank you https://github.com/TuriJ95!
110-
- Fixed Bug: ignore-package not working, thank you https://github.com/mathiasbockwoldt !
114+
- Fixed Bug: fix behaviour of dependency discovery for 'extras', thank you <https://github.com/TuriJ95>!
115+
- Fixed Bug: ignore-package not working, thank you <https://github.com/mathiasbockwoldt> !
111116

112117
## 2023.3 - 2023/07/29
113118

114-
- Fixed Bug: requirements:requirements.txt reading mode, thank you https://github.com/NicolaDonelli
119+
- Fixed Bug: requirements:requirements.txt reading mode, thank you <https://github.com/NicolaDonelli>
115120
- Fixed Bug: Permissive libraries are not compatible with closed licenses. Closes #49
116121
- Fixed Bug: Unexpected warnings for ignored license. Closes #48
117122
- New Feature: Support option ignore-licenses in pyproject.toml. Closes #46
@@ -134,19 +139,19 @@ patch-level version changes can be found in [commit messages](../../commits/mast
134139

135140
## 2023.1.2 - 2023/06/24
136141

137-
- Merge PR https://github.com/FHPythonUtils/LicenseCheck/pull/39 (Fixes #38)
142+
- Merge PR <https://github.com/FHPythonUtils/LicenseCheck/pull/39> (Fixes #38)
138143

139144
## 2023.1.1 - 2023/03/07
140145

141-
- Merge PR https://github.com/FHPythonUtils/LicenseCheck/pull/33
146+
- Merge PR <https://github.com/FHPythonUtils/LicenseCheck/pull/33>
142147
(implements feature: Support for PEP631: Declaring dependencies in pyproject.toml enhancement)
143148
- Fix crash if setup.cfg exists with no metadata section
144-
(https://github.com/FHPythonUtils/LicenseCheck/issues/34)
149+
(<https://github.com/FHPythonUtils/LicenseCheck/issues/34>)
145150

146151
## 2023
147152

148-
- Fix: https://github.com/FHPythonUtils/LicenseCheck/issues/26
149-
- Fix python 3.8 compatibility, thanks https://github.com/NicolaDonelli !
153+
- Fix: <https://github.com/FHPythonUtils/LicenseCheck/issues/26>
154+
- Fix python 3.8 compatibility, thanks <https://github.com/NicolaDonelli> !
150155

151156
## 2022.3.2 - 2022/12/30
152157

@@ -163,13 +168,13 @@ patch-level version changes can be found in [commit messages](../../commits/mast
163168

164169
## 2022.2.0 - 2022/10/22
165170

166-
- Add support for `setup.cfg` https://github.com/FHPythonUtils/LicenseCheck/issues/21
167-
(thank you https://github.com/NicolaDonelli for the code :))
168-
- Use rich for table rendering https://github.com/FHPythonUtils/LicenseCheck/issues/20
171+
- Add support for `setup.cfg` <https://github.com/FHPythonUtils/LicenseCheck/issues/21>
172+
(thank you <https://github.com/NicolaDonelli> for the code :))
173+
- Use rich for table rendering <https://github.com/FHPythonUtils/LicenseCheck/issues/20>
169174

170175
## 2022.1.1 - 2022/04/09
171176

172-
- More detailed warnings per https://github.com/FHPythonUtils/LicenseCheck/issues/19
177+
- More detailed warnings per <https://github.com/FHPythonUtils/LicenseCheck/issues/19>
173178
- Add check using spdx identifiers
174179

175180
## 2022.1 - 2022/04/06
@@ -185,14 +190,14 @@ patch-level version changes can be found in [commit messages](../../commits/mast
185190

186191
## 2022.0.1 - 2022/02/01
187192

188-
- Hopefully fix https://github.com/FHPythonUtils/LicenseCheck/issues/14 for real this time
193+
- Hopefully fix <https://github.com/FHPythonUtils/LicenseCheck/issues/14> for real this time
189194
- Update deps
190195
- Remove `pip`
191196
- Replace `tomlkit` with `tomli`
192197

193198
## 2022 - 2022/01/14
194199

195-
- Fix https://github.com/FHPythonUtils/LicenseCheck/issues/18
200+
- Fix <https://github.com/FHPythonUtils/LicenseCheck/issues/18>
196201

197202
## 2021.5.2 - 2021/10/18
198203

@@ -201,35 +206,35 @@ patch-level version changes can be found in [commit messages](../../commits/mast
201206

202207
## 2021.5 - 2021/09/14
203208

204-
- Add `-u poetry:dev` to command-line to include dev packages (excluded by default) per https://github.com/FHPythonUtils/LicenseCheck/issues/16
205-
- Add support for proprietary license per https://github.com/FHPythonUtils/LicenseCheck/issues/15
206-
- Raise RuntimeError if missing license and classifier https://github.com/FHPythonUtils/LicenseCheck/issues/14
209+
- Add `-u poetry:dev` to command-line to include dev packages (excluded by default) per <https://github.com/FHPythonUtils/LicenseCheck/issues/16>
210+
- Add support for proprietary license per <https://github.com/FHPythonUtils/LicenseCheck/issues/15>
211+
- Raise RuntimeError if missing license and classifier <https://github.com/FHPythonUtils/LicenseCheck/issues/14>
207212
- Quality improvements to license_matrix.py
208213
- Add additional examples to readme
209-
- Support pre-commit-hooks https://github.com/FHPythonUtils/LicenseCheck/issues/8
214+
- Support pre-commit-hooks <https://github.com/FHPythonUtils/LicenseCheck/issues/8>
210215

211216
## 2021.4.1 - 2021/09/07
212217

213218
- Command-line options take precedent over config options as expected
214219

215220
## 2021.4 - 2021/09/07
216221

217-
- Add config file functionality per https://github.com/FHPythonUtils/LicenseCheck/issues/11
218-
- Parsed in the following order: `pyproject.toml`, `setup.cfg`, `licensecheck.toml`, `licensecheck.json`, `licensecheck.ini`, `~/licensecheck.toml`, `~/licensecheck.json`, `~/licensecheck.ini`
219-
- Note that the config takes precedent over command-line options
220-
- Add optional path to requirements.txt as outlined in https://github.com/FHPythonUtils/LicenseCheck/issues/9#issuecomment-898878228
221-
- Eg. `licensecheck --using requirements:c:/path/to/reqs.txt;path/to/other/reqs.txt`
222+
- Add config file functionality per <https://github.com/FHPythonUtils/LicenseCheck/issues/11>
223+
- Parsed in the following order: `pyproject.toml`, `setup.cfg`, `licensecheck.toml`, `licensecheck.json`, `licensecheck.ini`, `~/licensecheck.toml`, `~/licensecheck.json`, `~/licensecheck.ini`
224+
- Note that the config takes precedent over command-line options
225+
- Add optional path to requirements.txt as outlined in <https://github.com/FHPythonUtils/LicenseCheck/issues/9#issuecomment-898878228>
226+
- Eg. `licensecheck --using requirements:c:/path/to/reqs.txt;path/to/other/reqs.txt`
222227

223228
## 2021.3 - 2021/08/13
224229

225-
- Add `--ignore-packages`, `--fail-packages`,`--ignore-licenses`, `--fail-licenses`, per https://github.com/FHPythonUtils/LicenseCheck/issues/7
230+
- Add `--ignore-packages`, `--fail-packages`,`--ignore-licenses`, `--fail-licenses`, per <https://github.com/FHPythonUtils/LicenseCheck/issues/7>
226231
- Fix spelling
227232
- Added a couple examples to the readme
228233
- Added pylintrc to pyproject.toml
229234

230235
## 2021.2 - 2021/08/13
231236

232-
- Added ability to use requirements.txt per https://github.com/FHPythonUtils/LicenseCheck/issues/6
237+
- Added ability to use requirements.txt per <https://github.com/FHPythonUtils/LicenseCheck/issues/6>
233238
- Code clean-up + refactoring
234239
- Fix spelling
235240
- packagecompat.py → types.py as this module holds types + typing info
@@ -247,19 +252,19 @@ patch-level version changes can be found in [commit messages](../../commits/mast
247252

248253
- Tidied up
249254
- Added `--zero/-0` flag to return non-zero exit code when an incompatible
250-
license is found
255+
license is found
251256

252257
## 2021 - 2021/01/24
253258

254259
- Updated requirements
255260
- Fallback to requirements.txt when poetry throws an error and direct the user
256-
to troubleshoot
261+
to troubleshoot
257262

258263
## 2020.0.4 - 2020/10/14
259264

260265
- Improved support for GPL fans out there by detecting variants in a more
261-
granular manner. Fewer false -ves for said GPL variants. E.g. a dependency with
262-
GPL2 only will be flagged for a project using GPL3
266+
granular manner. Fewer false -ves for said GPL variants. E.g. a dependency with
267+
GPL2 only will be flagged for a project using GPL3
263268

264269
## 2020.0.3 - 2020/10/12
265270

licensecheck/cli.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,8 @@ def main(args: dict[str, Any]) -> int:
145145
for file in config_files:
146146
config += Config.from_path(file, optional=True)
147147

148-
scopedData: ConfigNode = config.get("tool", {}).get(
149-
"licensecheck", ConfigNode()
150-
)
151-
scopedConfig = {**scopedData.data, **args}
148+
scopedData: ConfigNode = config.get("tool", {}).get("licensecheck", ConfigNode())
149+
scopedConfig: dict[str, Any] = {**scopedData.data, **args}
152150

153151
# File
154152
requirements_paths = scopedConfig.get("requirements_paths") or ["__stdin__"]
@@ -159,9 +157,7 @@ def main(args: dict[str, Any]) -> int:
159157
)
160158

161159
# Get my license
162-
this_license_text = (
163-
scopedConfig.get("license") or packageinfo.ProjectMetadata.get_license()
164-
)
160+
this_license_text = scopedConfig.get("license") or packageinfo.ProjectMetadata.get_license()
165161
this_license = license_matrix.licenseType(this_license_text).pop()
166162

167163
def getFromConfig(key: str) -> set[types.ucstr]:

licensecheck/license_matrix/__init__.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
from loguru import logger
4545

46-
from licensecheck.types import JOINS, ucstr
46+
from licensecheck.types import JOINS, License, ucstr
4747
from licensecheck.types import License as L
4848

4949
THISDIR = Path(__file__).resolve().parent
@@ -52,7 +52,7 @@
5252
LICENSE_MATRIX: list[list[str]] = list[list[str]](csv.reader(csv_file))
5353

5454

55-
termToLicense = {
55+
termToLicenseData = {
5656
"UNKNOWN": L.UNKNOWN,
5757
"PUBLIC DOMAIN": L.PUBLIC,
5858
"CC-PDDC": L.PUBLIC,
@@ -64,7 +64,8 @@
6464
"MIT": L.MIT,
6565
"BSD": L.BSD,
6666
"ISC": L.ISC,
67-
"UPL-1.0": L.UPL_1,
67+
"EUPL": L.EU,
68+
"UPL": L.UPL_1,
6869
"NCSA": L.NCSA,
6970
"PYTHON": L.PSFL,
7071
"PSF-2.0": L.PSFL,
@@ -79,7 +80,7 @@
7980
"LGPL-3.0-OR-LATER": L.LGPL_3_PLUS,
8081
"LGPL-2.0-ONLY": L.LGPL_2,
8182
"LGPLV2": L.LGPL_2,
82-
"GNU LIBRARY": L.LGPL_2,
83+
"GNU LIBRARY": L.LGPL_X,
8384
"LGPL-3.0-ONLY": L.LGPL_3,
8485
"LGPLV3": L.LGPL_3,
8586
"LGPL": L.LGPL_X,
@@ -95,10 +96,17 @@
9596
"GPL-3.0": L.GPL_3,
9697
"GPL": L.GPL_X,
9798
"MPL": L.MPL,
98-
"EUPL": L.EU,
9999
"PROPRIETARY": L.PROPRIETARY,
100100
}
101101

102+
termToLicense: dict[str, License] = dict(
103+
sorted(
104+
termToLicenseData.items(),
105+
key=lambda item: len(item[0]),
106+
reverse=True,
107+
)
108+
)
109+
102110

103111
def licenseLookup(licenseStr: ucstr, ignoreLicenses: set[ucstr] | None = None) -> L:
104112
"""Identify a license from an uppercase string representation of a license.

licensecheck/packageinfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from __future__ import annotations
44

55
import configparser
6-
from concurrent.futures import ThreadPoolExecutor
76
import contextlib
87
import re
98
from collections.abc import Iterable
9+
from concurrent.futures import ThreadPoolExecutor
1010
from email.message import Message
1111
from importlib import metadata
1212
from pathlib import Path
@@ -62,7 +62,7 @@ def getPackages(self) -> set[PackageInfo]:
6262
:return set[PackageInfo]: A set of package information objects.
6363
"""
6464
with ThreadPoolExecutor() as executor:
65-
return set(executor.map(self.get_package_info, self.reqs))
65+
return set(executor.map(self._get_package_info, self.reqs))
6666

6767
def _get_package_info(self, package: Requirement) -> PackageInfo:
6868
"""Retrieve package information, preferring local data.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "licensecheck"
3-
version = "2026.0.0"
3+
version = "2026.0.1"
44
description = "Output the licenses used by dependencies and check if these are compatible with the project license"
55
authors = [{ name = "FredHappyface" }]
66
requires-python = ">=3.12"

tests/platform_independent/data/licenseCheckLicenses.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ UNKNOWN
7171
UNKNOWN
7272
UNKNOWN
7373
UNLICENSE
74-
UNKNOWN
74+
UPL_1
7575
NCSA
7676
UNKNOWN
7777
UNKNOWN

tests/platform_independent/test_checker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def test_check(
3232
ignore_packages: set[str] | None,
3333
fail_packages: set[str] | None,
3434
fail_licenses: set[str] | None,
35-
*, expected_incompatible: bool,
35+
*,
36+
expected_incompatible: bool,
3637
) -> None:
3738
"""Parametrized test for different license check scenarios."""
3839
mock_packages = {

tests/platform_independent/test_license_matrix.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ def test_licenseLookup() -> None:
2323
licenses.append(licenseName)
2424

2525
licenses.append("NO_LICENSE")
26+
msgs = []
2627
for x in types.License._member_names_:
2728
if x not in licenses:
28-
msg = f"{x} not in licenses"
29-
logger.error(msg)
30-
raise AssertionError(msg)
29+
msgs.append( f"{x} not in licenses")
30+
31+
if len(msgs):
32+
logger.error(msgs)
33+
raise AssertionError(msgs)
3134

3235
cmp_file = Path(f"{THISDIR}/data/licenseCheckLicenses.txt")
3336

@@ -52,7 +55,7 @@ def test_licenseType_unknown() -> None:
5255

5356
def test_licenseType_empty() -> None:
5457
no_licenses = {
55-
all(x == types.L.NO_LICENSE for x in license_matrix.licenseType(y)) for y in {"", None}
58+
all(x == types.L.NO_LICENSE for x in license_matrix.licenseType(y)) for y in ("", None)
5659
}
5760
assert all(no_licenses)
5861

0 commit comments

Comments
 (0)