From c1ee926211edd6b5c93305ed67f7588197ba7281 Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Thu, 6 Aug 2026 16:33:55 -0700 Subject: [PATCH] add --version and bump to 0.2.0 Resolve the package version from installed metadata, report it via a --version flag, and print it at the start of each run so output logs record which wikiq produced them. Bump the version to 0.2.0 for the changes on this branch: regex match counting, the removal of parquet output, the Python 3.11 floor, and the dependency cleanup. Co-Authored-By: Claude Fable 5 --- pyproject.toml | 2 +- src/wikiq/__init__.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4c35e70..7deb2f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mediawiki-dump-tools" -version = "0.1.1" +version = "0.2.0" description = "Convert MediaWiki XML database dumps into tabular datasets for research" readme = "README.md" license = "GPL-3.0-or-later" diff --git a/src/wikiq/__init__.py b/src/wikiq/__init__.py index 349443e..70fff19 100755 --- a/src/wikiq/__init__.py +++ b/src/wikiq/__init__.py @@ -48,6 +48,13 @@ from wikiq.wiki_diff_matcher import WikiDiffMatcher from wikiq.wikitext_parser import WikitextParser from wikiq.resume import get_resume_point +try: + from importlib.metadata import PackageNotFoundError + from importlib.metadata import version as _package_version + __version__ = _package_version("mediawiki-dump-tools") +except PackageNotFoundError: + __version__ = "unknown" + TO_ENCODE = ("title", "editor") PERSISTENCE_RADIUS = 7 DIFF_TIMEOUT_MS = 60000 @@ -1099,6 +1106,12 @@ def main(): help="Output file or directory. Format is detected from extension: .jsonl for JSONL, otherwise TSV.", ) + parser.add_argument( + "--version", + action="version", + version=f"wikiq {__version__}", + ) + parser.add_argument( "-s", "--stdout", @@ -1343,6 +1356,7 @@ def main(): print(json.dumps(spark_schema, indent=2)) sys.exit(0) + print(f"wikiq {__version__}", file=sys.stderr) print(args, file=sys.stderr) if len(args.dumpfiles) > 0: for filename in args.dumpfiles: