From 7106acfa553c90c75071f1fed7d7bba617ec40a2 Mon Sep 17 00:00:00 2001 From: Mikael Date: Sun, 14 Jun 2026 07:04:45 +0100 Subject: [PATCH 1/3] fix stdout on windows --- totolo/util/makejson.py | 5 ++++- totolo/util/mergelist.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/totolo/util/makejson.py b/totolo/util/makejson.py index 637ca04..04f18df 100644 --- a/totolo/util/makejson.py +++ b/totolo/util/makejson.py @@ -1,5 +1,6 @@ import argparse import json +import sys from collections import defaultdict import totolo.lib.argparse @@ -143,7 +144,9 @@ def main(): verbosity=args.verbosity, ) try: - print(json.dumps(dd, indent=4, ensure_ascii=False)) + sys.stdout.buffer.write(json.dumps(dd, indent=4, ensure_ascii=False).encode("utf-8")) + sys.stdout.buffer.write(b"\n") + sys.stdout.buffer.flush() except BrokenPipeError: # pragma: no cover pass diff --git a/totolo/util/mergelist.py b/totolo/util/mergelist.py index 524614a..7e50ba3 100644 --- a/totolo/util/mergelist.py +++ b/totolo/util/mergelist.py @@ -1,4 +1,5 @@ import argparse +import sys from collections import defaultdict import totolo @@ -256,6 +257,7 @@ def main(): help="Read and report on stdout, but do not write changes to ontology.", action="store_true", ) + sys.stdout.reconfigure(encoding='utf-8') args = parser.parse_args() mergelist(args.path_changes, args.path_ontology, args.dryrun) From 086b246400ee726c7bfc3b0a47344ffd1bb28d44 Mon Sep 17 00:00:00 2001 From: Mikael Date: Sun, 14 Jun 2026 08:26:51 +0100 Subject: [PATCH 2/3] remote.versions(): exclude v0.* package tags v0.* are early totolo package releases, not dated ontology snapshots, and makejson cannot build a corpus from them. Filter them out of versions() so listings/backfills only surface real ontology releases; version(v0.3.3) still works for explicit fetches. Co-Authored-By: Claude Opus 4.8 --- tests/test_totolo.py | 2 +- totolo/impl/api.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/test_totolo.py b/tests/test_totolo.py index 043ae52..47ac7df 100644 --- a/tests/test_totolo.py +++ b/tests/test_totolo.py @@ -68,7 +68,7 @@ def test_versions(self): precache_remote_resources() versions = [v for v, _ in totolo.remote.versions()] assert "v2023.06" in versions - assert "v0.3.3" in versions + assert "v0.3.3" not in versions # v0.* package tags are excluded from listings with pytest.raises(ValueError): totolo.remote.version("gobbledygook") diff --git a/totolo/impl/api.py b/totolo/impl/api.py index 696c992..b3b2928 100644 --- a/totolo/impl/api.py +++ b/totolo/impl/api.py @@ -1,4 +1,5 @@ import json +import re import urllib.request import functools @@ -9,6 +10,16 @@ API_URL = "https://api.github.com/repos/theme-ontology/theming/" +def _is_ontology_release(tag): + """Whether a release tag is a dated ontology snapshot (e.g. v2025.04). + + v0.* tags are early totolo package releases, not ontology versions, and + cannot be built into a corpus -- exclude them from version listings. + """ + match = re.match(r"v?(\d+)", tag) + return not (match and int(match.group(1)) == 0) + + def files(paths=None): return TOParser.add_files(empty(), paths) @@ -61,7 +72,9 @@ def version(self, version: str = ""): def versions(self): for item in self._get("releases"): - yield item["tag_name"], item["name"] + tag = item["tag_name"] + if _is_ontology_release(tag): + yield tag, item["name"] @functools.lru_cache def _get(self, endpoint): From 451adbeed7ac5419daf5e1156043f43c2b6cf6fb Mon Sep 17 00:00:00 2001 From: Mikael Date: Sun, 14 Jun 2026 08:32:37 +0100 Subject: [PATCH 3/3] Bump version to 2.1.3 Co-Authored-By: Claude Opus 4.8 --- totolo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/totolo/__init__.py b/totolo/__init__.py index 19f018e..06e37e8 100644 --- a/totolo/__init__.py +++ b/totolo/__init__.py @@ -5,7 +5,7 @@ remote = TORemote() -__version__ = "2.1.2" +__version__ = "2.1.3" __ALL__ = [ empty, files,