script for diff-checking added

This commit is contained in:
2026-06-10 11:41:01 +03:00
parent ec53a884dc
commit d69550bd5d
3 changed files with 181 additions and 0 deletions
+89
View File
@@ -0,0 +1,89 @@
from pathlib import Path
ALIASES = {
"bs4": "beautifulsoup4",
"python3-discogs-client": "discogs-client",
"typing_extensions": "typing-extensions",
}
ALLOWLIST = {
"httpx-socks",
"pysocks",
"socksio",
}
def normalize(pkg: str) -> str:
pkg = pkg.strip().lower().replace("_", "-")
return ALIASES.get(pkg, pkg)
def clean_line(line: str):
line = line.strip()
if not line:
return None
if line.startswith("#"):
return None
if " #" in line:
line = line.split(" #", 1)[0].strip()
return line
def parse_with_versions(data: str):
result = {}
for raw in data.splitlines():
line = clean_line(raw)
if not line:
continue
name, *version = line.split("==")
name = normalize(name)
result[name] = version[0] if version else None
return result
def parse_simple(data: str):
result = set()
for raw in data.splitlines():
line = clean_line(raw)
if not line:
continue
result.add(normalize(line))
return result
base_path = Path(__file__).parent
req_new_path = base_path / "requirements.txt"
req_old_path = base_path / "requirements-old.txt"
if not req_new_path.exists():
raise FileNotFoundError("requirements.txt не найден")
if not req_old_path.exists():
raise FileNotFoundError("requirements-old.txt не найден")
list1 = req_new_path.read_text(encoding="utf-8")
list2 = req_old_path.read_text(encoding="utf-8")
a = parse_with_versions(list1)
b = parse_simple(list2)
a_names = set(a.keys())
only_in_list2 = sorted(b - a_names)
only_in_list2_clean = [pkg for pkg in only_in_list2 if pkg not in ALLOWLIST]
ignored = [pkg for pkg in only_in_list2 if pkg in ALLOWLIST]
print("Только в list1:")
print(sorted(a_names - b))
print("\nТолько в list2 (кандидаты на удаление):")
print(only_in_list2_clean)
print("\nИгнорируемые (allowlist):")
print(sorted(ignored))
print("\nПодозрительные дубли (алиасы):")
for k, v in ALIASES.items():
if k in a_names:
print(f"{k} -> {v}")
+53
View File
@@ -0,0 +1,53 @@
# et-xmlfile
# exceptiongroup
# markdown-it-py
# mdurl
# munkres
# musicbrainzngs
# openpyxl
# pygments
# rich
# sniffio
anyio
beautifulsoup4
beetcamp
beets
certifi
charset-normalizer
colorama
confuse
discogs-client
filetype
h11
httpcore
httpx
httpx-socks
idna
jellyfish
langdetect
lap
llvmlite
mediafile
mutagen
numba
numpy
oauthlib
packaging
pillow
platformdirs
pycountry
pylast
pyrate-limiter
pysocks
python-dateutil
pyyaml
requests
requests-ratelimiter
scipy
# setuptools
six
socksio
soupsieve
typing-extensions
unidecode
urllib3
+39
View File
@@ -0,0 +1,39 @@
anyio==4.13.0
beautifulsoup4==4.14.3
beetcamp==0.24.3
beets==2.10.0
certifi==2026.4.22
charset-normalizer==3.4.7
colorama==0.4.6
confuse==2.2.0
filetype==1.2.0
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
idna==3.13
jellyfish==1.2.1
langdetect==1.0.9
lap==0.5.13
llvmlite==0.47.0
mediafile==0.17.0
mutagen==1.47.0
numba==0.65.1
numpy==2.4.4
oauthlib==3.3.1
packaging==26.2
pillow==12.2.0
platformdirs==4.9.6
pycountry==26.2.16
pylast==7.0.2
pyrate-limiter==4.1.0
python-dateutil==2.9.0.post0
python3-discogs-client==2.8
PyYAML==6.0.3
requests==2.33.1
requests-ratelimiter==0.10.0
scipy==1.17.1
six==1.17.0
soupsieve==2.8.3
typing_extensions==4.15.0
Unidecode==1.4.0
urllib3==2.6.3