dep15-lock-compare.py

import json, re, subprocess
from pathlib import Path
p='miz-oki-adk-agents/boss/requirements.lock.txt'
def pins(s):
 return dict(re.findall(r'^([A-Za-z0-9_.-]+)==([^\s]+)',s,re.M))
b=pins(subprocess.check_output(['git','show','origin/main:'+p],text=True)); h=pins(Path(p).read_text())
d={k:[b.get(k),h.get(k)] for k in sorted(b.keys()|h.keys()) if b.get(k)!=h.get(k)}
assert len(b)==len(h)==107 and d=={'oauthlib':['3.3.1','4.0.0']},d
print(json.dumps({'base_sha':subprocess.check_output(['git','rev-parse','origin/main'],text=True).strip(),'base':len(b),'head':len(h),'delta':d},indent=2))
← All docsView source on GitHub →