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 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "mediawiki-dump-tools"
|
name = "mediawiki-dump-tools"
|
||||||
version = "0.1.1"
|
version = "0.2.0"
|
||||||
description = "Convert MediaWiki XML database dumps into tabular datasets for research"
|
description = "Convert MediaWiki XML database dumps into tabular datasets for research"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ from wikiq.wiki_diff_matcher import WikiDiffMatcher
|
|||||||
from wikiq.wikitext_parser import WikitextParser
|
from wikiq.wikitext_parser import WikitextParser
|
||||||
from wikiq.resume import get_resume_point
|
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")
|
TO_ENCODE = ("title", "editor")
|
||||||
PERSISTENCE_RADIUS = 7
|
PERSISTENCE_RADIUS = 7
|
||||||
DIFF_TIMEOUT_MS = 60000
|
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.",
|
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(
|
parser.add_argument(
|
||||||
"-s",
|
"-s",
|
||||||
"--stdout",
|
"--stdout",
|
||||||
@@ -1343,6 +1356,7 @@ def main():
|
|||||||
print(json.dumps(spark_schema, indent=2))
|
print(json.dumps(spark_schema, indent=2))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
print(f"wikiq {__version__}", file=sys.stderr)
|
||||||
print(args, file=sys.stderr)
|
print(args, file=sys.stderr)
|
||||||
if len(args.dumpfiles) > 0:
|
if len(args.dumpfiles) > 0:
|
||||||
for filename in args.dumpfiles:
|
for filename in args.dumpfiles:
|
||||||
|
|||||||
Reference in New Issue
Block a user