import hashlib,json from pathlib import Path root=Path(__file__).resolve().parents[1] entries={str(p.relative_to(root)):hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(root.rglob('*')) if p.is_file() and '__pycache__' not in str(p) and p.name!='MANIFEST.sha256.json' and '.egg-info' not in str(p)} (root/'MANIFEST.sha256.json').write_text(json.dumps(entries,indent=2)+'\n') print('Hashed',len(entries),'files')