add --version and set the version to 0.3.0

wikiq had no way to report which version produced a dataset, which
matters when output columns change between runs that end up in the same
analysis. Add a --version flag, and print the version to stderr on every
run so it lands in job logs alongside the output.

0.3.0 is the first release published anywhere. The earlier 0.1.1 and
0.2.0 tags were internal markers that were never released, so the
version numbering starts being meaningful to users here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-06 16:33:55 -07:00
parent 77f185888f
commit b073b038af
2 changed files with 15 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
[project]
name = "mediawiki-dump-tools"
version = "0.1.1"
version = "0.3.0"
description = "Convert MediaWiki XML database dumps into tabular datasets for research"
readme = "README.md"
license = "GPL-3.0-or-later"

View File

@@ -46,6 +46,13 @@ from wikiq.tables import RevisionTable
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
@@ -1134,6 +1141,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",
@@ -1391,6 +1404,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: