mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
fix: repair strict ruff config chain and make check_licenses.py CWD-independent
ruff-strict.toml extended the deleted ruff.toml, which broke the strict gate in CI; ruff supports extending a pyproject.toml directly, and the per-rule strict finding counts are identical before and after (60481 findings, same per-rule distribution), with scripts/ruff_strict_gate.py passing end to end Also anchor the pyproject.toml, uv.lock and liccheck.ini reads in check_licenses.py to the script location, matching the cache path fix, so the script no longer depends on being run from the repo root (Greptile P2)
This commit is contained in:
parent
6378f9b470
commit
85a1a4fab8
2 changed files with 8 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
|||
extend = "ruff.toml"
|
||||
extend = "pyproject.toml"
|
||||
|
||||
[lint]
|
||||
preview = true
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ from typing import Dict, List, Optional, Set, Tuple
|
|||
from packaging.requirements import Requirement
|
||||
import requests
|
||||
|
||||
_SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
_REPO_ROOT = _SCRIPT_DIR.parent.parent
|
||||
|
||||
DEFAULT_TRANSITIVE_PIN_PACKAGES = (
|
||||
"aiofiles",
|
||||
"anyio",
|
||||
|
|
@ -50,7 +53,7 @@ class PackageLicense:
|
|||
|
||||
class LicenseChecker:
|
||||
def __init__(
|
||||
self, config_file: Path = Path("./tests/code_coverage_tests/liccheck.ini")
|
||||
self, config_file: Path = _SCRIPT_DIR / "liccheck.ini"
|
||||
):
|
||||
if not config_file.exists():
|
||||
print(f"Error: Config file {config_file} not found")
|
||||
|
|
@ -71,7 +74,7 @@ class LicenseChecker:
|
|||
self.authorized_packages = self._parse_authorized_packages()
|
||||
|
||||
# Initialize cache
|
||||
self.cache_file = Path(__file__).parent / "license_cache.json"
|
||||
self.cache_file = _SCRIPT_DIR / "license_cache.json"
|
||||
self.license_cache: Dict[str, str] = {}
|
||||
if self.cache_file.exists():
|
||||
with open(self.cache_file) as f:
|
||||
|
|
@ -314,9 +317,9 @@ class LicenseChecker:
|
|||
with open(requirements_file) as f:
|
||||
requirement_lines = f.readlines()
|
||||
else:
|
||||
with open("pyproject.toml", "rb") as f:
|
||||
with open(_REPO_ROOT / "pyproject.toml", "rb") as f:
|
||||
pyproject = tomllib.load(f)
|
||||
with open("uv.lock", "rb") as f:
|
||||
with open(_REPO_ROOT / "uv.lock", "rb") as f:
|
||||
lock_data = tomllib.load(f)
|
||||
|
||||
requirement_lines = list(pyproject["project"].get("dependencies", []))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue