Datasets:
fix: only document sources that are actually committed
Browse filesThe "Sources on main, not yet released" table listed parlamint_pl, linking
data/parlamint_pl/parlamint_pl.md — a path that does not exist on main and
404s for every reader. make_docs reads the working tree, so an uncommitted
data/ directory in whoever regenerates the docs becomes a published claim
about the main branch.
make_docs now asks git which data/ directories are committed and leaves the
rest out of the README, naming them on stdout instead. The datasheet is still
written first, so a contributor can generate it in the same commit that adds
the data. The check disables itself when git cannot answer.
Also drops parlamint_pl from the CHANGELOG's Unreleased entry, which made the
same claim.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UXd7RSpYjF6SX2fFMygxic
- CHANGELOG.md +2 -2
- README.md +0 -1
- src/make_docs.py +25 -1
|
@@ -2,8 +2,8 @@
|
|
| 2 |
|
| 3 |
## Unreleased (on main)
|
| 4 |
|
| 5 |
-
- `wiktionary_examples`
|
| 6 |
-
|
| 7 |
They are excluded from every release total until a release entry admits them.
|
| 8 |
The registry records this as `release: None` in `src/sources.py`; release
|
| 9 |
totals count only sources whose `release` is set and not newer than the
|
|
|
|
| 2 |
|
| 3 |
## Unreleased (on main)
|
| 4 |
|
| 5 |
+
- `wiktionary_examples` and `sejm_api` are built, documented and present on
|
| 6 |
+
the main branch but have never been admitted to a stable release.
|
| 7 |
They are excluded from every release total until a release entry admits them.
|
| 8 |
The registry records this as `release: None` in `src/sources.py`; release
|
| 9 |
totals count only sources whose `release` is set and not newer than the
|
|
@@ -189,7 +189,6 @@ Built and documented, but **not** part of v0.2.5 and excluded from every total a
|
|
| 189 |
|
| 190 |
| source | description | license | documents | tokens |
|
| 191 |
|---|---|---|---:|---:|
|
| 192 |
-
| [parlamint_pl](data/parlamint_pl/parlamint_pl.md) | ParlaMint-PL (parliamentary debates, 2015-2022) | `CC-BY-4.0` | 686 | 95.4M |
|
| 193 |
| [sejm_api](data/sejm_api/sejm_api.md) | Sejm API parliamentary speeches (2023 onward) | `public-domain (official documents)` | 38,812 | 36.3M |
|
| 194 |
| [wiktionary_examples](data/wiktionary_examples/wiktionary_examples.md) | Polish Wiktionary usage examples | `CC-BY-SA-3.0` | 8,639 | 1.1M |
|
| 195 |
|
|
|
|
| 189 |
|
| 190 |
| source | description | license | documents | tokens |
|
| 191 |
|---|---|---|---:|---:|
|
|
|
|
| 192 |
| [sejm_api](data/sejm_api/sejm_api.md) | Sejm API parliamentary speeches (2023 onward) | `public-domain (official documents)` | 38,812 | 36.3M |
|
| 193 |
| [wiktionary_examples](data/wiktionary_examples/wiktionary_examples.md) | Polish Wiktionary usage examples | `CC-BY-SA-3.0` | 8,639 | 1.1M |
|
| 194 |
|
|
@@ -9,7 +9,7 @@ Implements the "Documented" principle (datasheets, Gebru et al. 2021) and the
|
|
| 9 |
aggregate README table (paper 2508.02271).
|
| 10 |
"""
|
| 11 |
from __future__ import annotations
|
| 12 |
-
import json, sys
|
| 13 |
from pathlib import Path
|
| 14 |
|
| 15 |
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
@@ -136,8 +136,25 @@ Llama-3 count is computed at release.
|
|
| 136 |
"""
|
| 137 |
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
def main():
|
| 140 |
current = parse_version(VERSION)
|
|
|
|
| 141 |
rows, pending, tot_doc, tot_tok, tot_chr = [], [], 0, 0, 0
|
| 142 |
for name, cfg in SOURCES.items():
|
| 143 |
st = load_stats(name)
|
|
@@ -147,6 +164,13 @@ def main():
|
|
| 147 |
# date) opt out of template regeneration to avoid clobbering it.
|
| 148 |
if not cfg.get("custom_datasheet"):
|
| 149 |
write_text(ROOT / "data" / name / f"{name}.md", datasheet(name, cfg, st))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
release = cfg.get("release")
|
| 151 |
if release is None or parse_version(release) > current:
|
| 152 |
# Built and on main, but not admitted to this release: never counted.
|
|
|
|
| 9 |
aggregate README table (paper 2508.02271).
|
| 10 |
"""
|
| 11 |
from __future__ import annotations
|
| 12 |
+
import json, subprocess, sys
|
| 13 |
from pathlib import Path
|
| 14 |
|
| 15 |
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
|
|
| 136 |
"""
|
| 137 |
|
| 138 |
|
| 139 |
+
def committed_sources():
|
| 140 |
+
"""Source names whose data/ directory is committed -- i.e. actually on main.
|
| 141 |
+
|
| 142 |
+
make_docs reads the working tree, so an uncommitted data/<name>/ would be
|
| 143 |
+
written into the README as a source "on main" and linked to a path that 404s
|
| 144 |
+
for everyone else. None when git cannot answer, which disables the check
|
| 145 |
+
rather than the tool.
|
| 146 |
+
"""
|
| 147 |
+
try:
|
| 148 |
+
out = subprocess.run(["git", "ls-tree", "-d", "--name-only", "HEAD", "data/"],
|
| 149 |
+
cwd=ROOT, capture_output=True, text=True, check=True).stdout
|
| 150 |
+
except (OSError, subprocess.CalledProcessError):
|
| 151 |
+
return None
|
| 152 |
+
return {line.rstrip("/").split("/")[-1] for line in out.split()}
|
| 153 |
+
|
| 154 |
+
|
| 155 |
def main():
|
| 156 |
current = parse_version(VERSION)
|
| 157 |
+
committed = committed_sources()
|
| 158 |
rows, pending, tot_doc, tot_tok, tot_chr = [], [], 0, 0, 0
|
| 159 |
for name, cfg in SOURCES.items():
|
| 160 |
st = load_stats(name)
|
|
|
|
| 164 |
# date) opt out of template regeneration to avoid clobbering it.
|
| 165 |
if not cfg.get("custom_datasheet"):
|
| 166 |
write_text(ROOT / "data" / name / f"{name}.md", datasheet(name, cfg, st))
|
| 167 |
+
# The datasheet is written above, before this check: a contributor
|
| 168 |
+
# generates it in the same commit that adds the data, so it cannot
|
| 169 |
+
# require the data to already be committed.
|
| 170 |
+
if committed is not None and name not in committed:
|
| 171 |
+
print(f" ! {name}: data/{name}/ is not committed - datasheet written, "
|
| 172 |
+
"but left out of the README")
|
| 173 |
+
continue
|
| 174 |
release = cfg.get("release")
|
| 175 |
if release is None or parse_version(release) > current:
|
| 176 |
# Built and on main, but not admitted to this release: never counted.
|