fix: authorize urllib3/filelock in liccheck, replace pkg_resources with packaging

- Add urllib3 (MIT) and filelock (Unlicense) to [Authorized Packages] in liccheck.ini
- Fix DeprecationWarning by using packaging.requirements.Requirement instead of pkg_resources
This commit is contained in:
Alexsander Hamir 2026-02-10 10:24:19 -08:00
parent ddc590ab2e
commit 5db3820a1d
2 changed files with 9 additions and 4 deletions

View file

@ -1,7 +1,8 @@
#!/usr/bin/env python3
import sys
import pkg_resources
import requests
from packaging.requirements import Requirement
from pathlib import Path
import json
from typing import Dict, List, Optional, Set, Tuple
@ -213,7 +214,7 @@ class LicenseChecker:
try:
with open(requirements_file) as f:
requirements = [
pkg_resources.Requirement.parse(line)
Requirement(line.strip())
for line in f
if line.strip() and not line.startswith("#")
]
@ -225,8 +226,10 @@ class LicenseChecker:
for req in requirements:
try:
version = next(iter(req.specs))[1] if req.specs else None
except Exception:
version = (
next(iter(req.specifier)).version if req.specifier else None
)
except StopIteration:
version = None
if not self.check_package(req.name, version):

View file

@ -111,6 +111,7 @@ ddtrace: >=2.19.0 # Unknown license
orjson: >=3.10.12 # Unknown license
apscheduler: >=3.10.4 # Unknown license
fastapi-sso: >=0.16.0 # Unknown license
filelock: >=3.20.0 # Unlicense (public domain) - https://unlicense.org / https://github.com/tox-dev/filelock
pyjwt: >=2.9.0 # Unknown license
python-multipart: >=0.0.18 # Unknown license
pillow: >=11.0.0 # Unknown license
@ -123,6 +124,7 @@ opentelemetry-exporter-otlp: >=1.25.0 # Unknown license
sentry_sdk: >=2.21.0 # Unknown license
cryptography: >=43.0.1 # Unknown license
tzdata: >=2025.1 # Unknown license
urllib3: >=2.0.0 # MIT license - https://github.com/urllib3/urllib3
python-dotenv: >=1.0.0 # Unknown license
tiktoken: >=0.8.0 # Unknown license
click: >=8.1.7 # Unknown license