dep14-lock-compare.py
import json, re, subprocess
from pathlib import Path
p='services/coding-moa/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)==56 and d=={'pyjwt':['2.14.0','2.15.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))