thundercode commited on
Commit
7237a5c
·
verified ·
1 Parent(s): b6e40ec

release: add tools/generate_release_manifest.py

Browse files
Files changed (1) hide show
  1. tools/generate_release_manifest.py +101 -0
tools/generate_release_manifest.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Generate RELEASE_MANIFEST.md for the curated public release (Phase 5).
2
+
3
+ Lists every file in the curated release tree with its size and sha256, computed from disk.
4
+ Also emits a machine-readable models/checksums.sha256-style listing for the whole release.
5
+ """
6
+ import hashlib
7
+ import os
8
+ import sys
9
+ import datetime
10
+
11
+ HERE = os.path.dirname(os.path.abspath(__file__))
12
+ REPO = os.path.abspath(os.path.join(HERE, "..", "repo"))
13
+ OUT = os.path.join(REPO, "RELEASE_MANIFEST.md")
14
+
15
+ SKIP_NAMES = {"RELEASE_MANIFEST.md"}
16
+
17
+
18
+ def sha256_of(path, chunk=1 << 20):
19
+ h = hashlib.sha256()
20
+ with open(path, "rb") as fh:
21
+ while True:
22
+ b = fh.read(chunk)
23
+ if not b:
24
+ break
25
+ h.update(b)
26
+ return h.hexdigest()
27
+
28
+
29
+ def main():
30
+ rows = []
31
+ for dirpath, dirnames, filenames in os.walk(REPO):
32
+ dirnames[:] = sorted(d for d in dirnames if d not in {"__pycache__", ".git"})
33
+ for fn in sorted(filenames):
34
+ if fn in SKIP_NAMES:
35
+ continue
36
+ full = os.path.join(dirpath, fn)
37
+ rel = os.path.relpath(full, REPO).replace(os.sep, "/")
38
+ rows.append((rel, os.path.getsize(full), sha256_of(full)))
39
+
40
+ rows.sort()
41
+
42
+ total = sum(r[1] for r in rows)
43
+ lines = []
44
+ lines.append("# Release Manifest")
45
+ lines.append("")
46
+ lines.append("**Repository:** `Anish-lab-blip/SatQuery-AI` (public)")
47
+ lines.append(f"**Generated:** {datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0).isoformat()}")
48
+ lines.append("**Generator:** `release/tools/generate_release_manifest.py` (computed from disk, never typed)")
49
+ lines.append("")
50
+ lines.append(f"**Files:** {len(rows)} · **Total size:** {total:,} bytes ({total/1024:.1f} KiB)")
51
+ lines.append("")
52
+ lines.append("Every file in this release, with its size and sha256. Verify a checkout with:")
53
+ lines.append("")
54
+ lines.append("```bash")
55
+ lines.append("# for each row: echo '<sha256> <path>' | sha256sum -c -")
56
+ lines.append("```")
57
+ lines.append("")
58
+ lines.append("| # | Path | Bytes | sha256 |")
59
+ lines.append("|---|---|---|---|")
60
+ for i, (rel, size, h) in enumerate(rows, 1):
61
+ lines.append(f"| {i} | `{rel}` | {size:,} | `{h}` |")
62
+ lines.append("")
63
+ lines.append("## Machine-readable listing")
64
+ lines.append("")
65
+ lines.append("```")
66
+ for rel, size, h in rows:
67
+ lines.append(f"{h} {rel}")
68
+ lines.append("```")
69
+ lines.append("")
70
+ lines.append("## Contents summary")
71
+ lines.append("")
72
+ lines.append("| Area | What it is |")
73
+ lines.append("|---|---|")
74
+ lines.append("| `README.md` | the repository front page |")
75
+ lines.append("| `MODEL_CARD.md` | model card for the six trained artifacts |")
76
+ lines.append("| `docs/` | the research + engineering documentation set |")
77
+ lines.append("| `docs/architecture/` | the deep architecture reference (multi-part) |")
78
+ lines.append("| `models/manifest.json` | generated manifest of the six trained artifacts |")
79
+ lines.append("| `models/checksums.sha256` | generated checksums for the six trained artifacts |")
80
+ lines.append("| `screenshots/` | real live-run captures |")
81
+ lines.append("")
82
+ lines.append("## What this release deliberately does NOT contain")
83
+ lines.append("")
84
+ lines.append("- **Backbone weights.** They are fetched from the Hugging Face Hub, pinned by revision.")
85
+ lines.append("- **Secrets.** No tokens, keys, or environment files.")
86
+ lines.append("- **The private deployment repositories.** Their sources are not published here.")
87
+ lines.append("- **Datasets.** Acquisition procedures are documented; the data is not redistributed.")
88
+ lines.append("- **A licence file.** None has been selected yet — this is an OPEN item.")
89
+
90
+ with open(OUT, "w", encoding="utf-8", newline="\n") as fh:
91
+ fh.write("\n".join(lines) + "\n")
92
+
93
+ print(f"wrote {OUT}")
94
+ print(f"files: {len(rows)} total: {total:,} bytes")
95
+ for rel, size, h in rows:
96
+ print(f" {size:>10,} {rel}")
97
+ return 0
98
+
99
+
100
+ if __name__ == "__main__":
101
+ sys.exit(main())