skillfed

wikitextparser

A simple parsing tool for MediaWiki's wikitext markup.

wikitextparser v1.0.3 127.2K downloads/30d#11,749 on PyPI328
Copyleft license GNU General Public License v3 (GPLv3) Active released

What it is and what it does

WikiTextParser is a library for parsing and manipulating MediaWiki's wikitext syntax. It lets you extract structured elements—templates, parameters, wikilinks, tables, sections, lists, and HTML tags—from raw wiki markup and modify them programmatically. The library handles nested templates, colspan/rowspan in tables, category detection, and section hierarchy, making it suitable for bulk editing, data extraction, or automated wiki maintenance tasks.

The package depends on regex and wcwidth for pattern matching and text width calculation. It is actively maintained, supports modern Python versions (3.8+), and has no known security vulnerabilities. The GPLv3 license means any code using it must also be open-source under the same license.

Use it for:

  • Extract template arguments and parameter values from Wikipedia or MediaWiki dumps for data analysis.
  • Bulk clean up or refactor wiki markup—remove duplicate template arguments, rename sections, or update wikilinks.
  • Parse and validate wikitext structure before uploading edits to a wiki via API.
  • Build wiki bots that read, modify, and rewrite wikitext without corrupting nested markup.
  • Convert or normalize wiki markup (e.g., change list types or reformat table structure).

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses and manipulates MediaWiki wikitext markup, extracting and modifying templates, wikilinks, tables, sections, lists, and other wiki elements programmatically.

Yes. The package is actively maintained, has low install friction, no security issues, and fills a specific need for MediaWiki wikitext parsing. The GPLv3 copyleft license is a hard constraint only if you need proprietary distribution; for open-source projects, wiki automation, or data extraction, it is a straightforward choice.

Install

wikitextparser on PyPI

pip

pip install wikitextparser

uv

uv add wikitextparser

poetry

poetry add wikitextparser

Installing wikitextparser

Before you install

Low install friction with a pure-Python wheel distribution. Actively maintained with a recent release (14 days ago) and steady commit activity. Two lightweight runtime dependencies (regex and wcwidth) add minimal overhead.

License in practice

Licensed under GPLv3 (copyleft). Any derivative work or distribution must also be open-source under GPLv3; proprietary applications cannot incorporate this code without releasing their own source.

Quickstart

pip install wikitextparser

import wikitextparser as wtp
parsed = wtp.parse('{{template|arg=value}}')
print(parsed.templates)

Requires Python 3.8 or later.

Verify before relying

  • Whether the library handles all edge cases and malformed HTML robustly (documentation notes it is not a fully-fledged HTML parser).
  • Performance characteristics on very large wikitext documents or deeply nested template structures.

Package facts

License GNU General Public License v3 (GPLv3) (copyleft)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 2 — regex, wcwidth
Maintenance actively maintained — 14 days since the last release
Last repo commit
First released
Downloads 127,237/month — #11,749 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: wikitextparser-1.0.3-py3-none-any.whl

Keywords: MediaWiki, wikitext, parser

License :: OSI Approved :: GNU General Public License v3 (GPLv3)Programming Language :: PythonTopic :: Text Processing

Tags

mediawiki wikitext parserextract templates from wiki markupparse wikitext pythonwiki markup manipulationwikilink extractionmediawiki template parserwikitext section extraction
mediawikiwiki-automationmarkup-parsing

More Text Processing packages