diff --git a/tests/code_coverage_tests/check_licenses.py b/tests/code_coverage_tests/check_licenses.py index dc7cc7c54ac..f49f6807a02 100644 --- a/tests/code_coverage_tests/check_licenses.py +++ b/tests/code_coverage_tests/check_licenses.py @@ -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): diff --git a/tests/code_coverage_tests/liccheck.ini b/tests/code_coverage_tests/liccheck.ini index dc46f83366a..e6e9d761ad5 100644 --- a/tests/code_coverage_tests/liccheck.ini +++ b/tests/code_coverage_tests/liccheck.ini @@ -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