Skip to content

Commit b4a564b

Browse files
committed
2023.4.3
1 parent 209d716 commit b4a564b

File tree

10 files changed

+60
-43
lines changed

10 files changed

+60
-43
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
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+
## 2023.4.3 - 2023/08/30
7+
8+
- 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 :)
9+
610
## 2023.4.2 - 2023/08/25
711

812
- Fixed Bug: handle missing urls for a pypi package https://github.com/FHPythonUtils/LicenseCheck/issues/57. Thank you https://github.com/Azraeht!

documentation/reference/licensecheck/get_deps.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Get Deps
1212

1313
## getDepsWithLicenses
1414

15-
[Show source in get_deps.py:157](../../../licensecheck/get_deps.py#L157)
15+
[Show source in get_deps.py:168](../../../licensecheck/get_deps.py#L168)
1616

1717
Get a set of dependencies with licenses and determine license compatibility.
1818

@@ -23,6 +23,7 @@ Get a set of dependencies with licenses and determine license compatibility.
2323
- `failPackages` *list[ucstr]* - a list of packages to fail (compat=False)
2424
- `ignoreLicenses` *list[ucstr]* - a list of licenses to ignore (skipped, compat may still be False)
2525
- `failLicenses` *list[ucstr]* - a list of licenses to fail (compat=False)
26+
- `skipDependencies` *list[ucstr]* - a list of dependencies to skip (compat=False)
2627

2728
#### Returns
2829

@@ -39,6 +40,7 @@ def getDepsWithLicenses(
3940
failPackages: list[ucstr],
4041
ignoreLicenses: list[ucstr],
4142
failLicenses: list[ucstr],
43+
skipDependencies: list[ucstr],
4244
) -> tuple[License, set[PackageInfo]]:
4345
...
4446
```
@@ -69,6 +71,7 @@ Get requirements for the end user project/ lib.
6971
#### Arguments
7072

7173
- `using` *str* - use requirements, poetry or PEP631.
74+
- `skipDependencies` *list[str]* - list of dependencies to skip.
7275

7376
#### Returns
7477

@@ -77,7 +80,7 @@ Get requirements for the end user project/ lib.
7780
#### Signature
7881

7982
```python
80-
def getReqs(using: str) -> set[ucstr]:
83+
def getReqs(using: str, skipDependencies: list(ucstr)) -> set[ucstr]:
8184
...
8285
```
8386

licensecheck/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def cli() -> None:
3232
parser.add_argument(
3333
"--using",
3434
"-u",
35-
help="Environment to use e.g. requirements.txt. one of: " f"{', '.join(get_deps.USINGS)}. default=poetry",
35+
help="Environment to use e.g. requirements.txt. one of: "
36+
f"{', '.join(get_deps.USINGS)}. default=poetry",
3637
)
3738
parser.add_argument(
3839
"--ignore-packages",
@@ -85,7 +86,11 @@ def cli() -> None:
8586
simpleConf = SimpleConf(configparser, "licensecheck", args)
8687

8788
# File
88-
filename = stdout if simpleConf.get("file") is None else open(simpleConf.get("file"), "w", encoding="utf-8")
89+
filename = (
90+
stdout
91+
if simpleConf.get("file") is None
92+
else open(simpleConf.get("file"), "w", encoding="utf-8")
93+
)
8994

9095
# Get list of licenses
9196
myLice, depsWithLicenses = get_deps.getDepsWithLicenses(
@@ -103,7 +108,9 @@ def cli() -> None:
103108
# Format the results
104109
if simpleConf.get("format", "simple") in formatter.formatMap:
105110
print(
106-
formatter.formatMap[simpleConf.get("format", "simple")](myLice, sorted(depsWithLicenses)),
111+
formatter.formatMap[simpleConf.get("format", "simple")](
112+
myLice, sorted(depsWithLicenses)
113+
),
107114
file=filename,
108115
)
109116
else:

licensecheck/get_deps.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ def resolveExtraReq(extraReq: str) -> ucstr | None:
103103
project = pyproject["project"]
104104
reqLists = [project["dependencies"]]
105105
except KeyError as error:
106-
raise RuntimeError("Could not find specification of requirements (pyproject.toml).") from error
106+
raise RuntimeError(
107+
"Could not find specification of requirements (pyproject.toml)."
108+
) from error
107109
if extras:
108110
reqLists.extend(project["optional-dependencies"][x] for x in extras.split(";"))
109111
for reqList in reqLists:

pyproject.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "licensecheck"
3-
version = "2023.4.2"
3+
version = "2023.4.3"
44
license = "mit"
55
description = "Output the licenses used by dependencies and check if these are compatible with the project license"
66
authors = ["FredHappyface"]
@@ -35,11 +35,12 @@ rich = "<14,>=13.4.2"
3535
requests-cache = "<2,>=1.1.0"
3636
packaging = "<24,>=23.1"
3737

38-
[tool.poetry.dev-dependencies]
39-
pytest = "^7.1.1"
40-
pylint = "^2.13.5"
41-
handsdown = "^1.1.0"
42-
coverage = "^6.3.2"
38+
[tool.poetry.group.dev.dependencies]
39+
pytest = "^7.4.0"
40+
pylint = "^2.17.5"
41+
handsdown = "^2.0.1"
42+
fhmake = "^2023"
43+
coverage = "^7.3.0"
4344

4445
[tool.black]
4546
line-length = 100

tests/data/advanced.ansi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
 
22
 Info 
3-
┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
4-
 Item   Value  
5-
┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
3+
┌─────────────────┬──────────────┐
4+
 Item   Value  
5+
├─────────────────┼──────────────┤
66
│ program  │ licensecheck │
77
│ version  │ 2023.1.3  │
88
│ license  │ MIT LICENSE  │
@@ -11,16 +11,16 @@
1111
 
1212
 List Of 
1313
 Errors 
14-
┏━━━━━━━━━━┓
15-
 Package  
16-
┡━━━━━━━━━━┩
14+
┌──────────┐
15+
 Package  
16+
├──────────┤
1717
│ example1 │
1818
└──────────┘
1919
 
2020
 List Of Packages 
21-
┏━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┓
22-
 Compatible  Package   License(s) 
23-
┡━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━┩
21+
┌────────────┬──────────┬────────────┐
22+
 Compatible  Package   License(s) 
23+
├────────────┼──────────┼────────────┤
2424
│ ✔  │ example0 │ mit  │
2525
│ ✖  │ example1 │ gpl3  │
2626
└────────────┴──────────┴────────────┘

tests/data/advanced.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
Info
3-
┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
4-
Item Value
5-
┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
3+
┌─────────────────┬──────────────┐
4+
Item Value
5+
├─────────────────┼──────────────┤
66
│ program │ licensecheck │
77
│ version │ 2023.1.3 │
88
│ license │ MIT LICENSE │
@@ -11,16 +11,16 @@
1111

1212
List Of
1313
Errors
14-
┏━━━━━━━━━━┓
15-
Package
16-
┡━━━━━━━━━━┩
14+
┌──────────┐
15+
Package
16+
├──────────┤
1717
│ example1 │
1818
└──────────┘
1919

2020
List Of Packages
21-
┏━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┓
22-
Compatible Package License(s)
23-
┡━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━┩
21+
┌────────────┬──────────┬────────────┐
22+
Compatible Package License(s)
23+
├────────────┼──────────┼────────────┤
2424
│ ✔ │ example0 │ mit │
2525
│ ✖ │ example1 │ gpl3 │
2626
└────────────┴──────────┴────────────┘

tests/data/simple.ansi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
 
22
 Info 
3-
┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
4-
 Item   Value  
5-
┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
3+
┌─────────────────┬──────────────┐
4+
 Item   Value  
5+
├─────────────────┼──────────────┤
66
│ program  │ licensecheck │
77
│ version  │ 2023.1.3  │
88
│ license  │ MIT LICENSE  │
99
│ project_license │ MIT LICENSE  │
1010
└─────────────────┴──────────────┘
1111
 
1212
 List Of Packages 
13-
┏━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┓
14-
 Compatible  Package  License(s) 
15-
┡━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━┩
13+
┌────────────┬─────────┬────────────┐
14+
 Compatible  Package  License(s) 
15+
├────────────┼─────────┼────────────┤
1616
│ ✖  │ example │ UNKNOWN  │
1717
└────────────┴─────────┴────────────┘

tests/data/simple.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11

22
Info
3-
┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
4-
Item Value
5-
┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
3+
┌─────────────────┬──────────────┐
4+
Item Value
5+
├─────────────────┼──────────────┤
66
│ program │ licensecheck │
77
│ version │ 2023.1.3 │
88
│ license │ MIT LICENSE │
99
│ project_license │ MIT LICENSE │
1010
└─────────────────┴──────────────┘
1111

1212
List Of Packages
13-
┏━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┓
14-
Compatible Package License(s)
15-
┡━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━┩
13+
┌────────────┬─────────┬────────────┐
14+
Compatible Package License(s)
15+
├────────────┼─────────┼────────────┤
1616
│ ✖ │ example │ UNKNOWN │
1717
└────────────┴─────────┴────────────┘

tests/test_get_deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_doGetReqs_requirements():
5656
pyproject = {}
5757
requirementsPaths = [Path(f"{THISDIR}/data/test_requirements.txt")]
5858
skipDependencies = ["TOSKIP"]
59-
59+
6060
deps = get_deps._doGetReqs(using, skipDependencies, extras, pyproject, requirementsPaths)
6161
assert deps == {
6262
"NUMPY",

0 commit comments

Comments
 (0)