wikitextparser
A simple parsing tool for MediaWiki's wikitext markup.
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 wikitextparseruv
uv add wikitextparserpoetry
poetry add wikitextparserInstalling 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
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
mwparserfromhellParses MediaWiki wikicode into a queryable…
permissive · top 5,000 on PyPI
wikipediaProvides simple Python access to Wikipedia…
permissive · top 5,000 on PyPI
mwcliProvides helper functions and classes for…
permissive · top 15,000 on PyPI
mwxmlEfficiently parse and stream-process MediaWiki…
permissive · top 15,000 on PyPI
pywikibotPywikibot is a Python framework that interfaces…
permissive · top 15,000 on PyPI
jira2markdownConverts JIRA markup text to Markdown…
permissive · top 15,000 on PyPI
ada-urlParse, validate, and manipulate URLs according…
permissive · top 15,000 on PyPI
mkdocs-embed-external-markdownA MkDocs plugin that fetches and embeds…
permissive · top 15,000 on PyPI
mwclientmwclient is a Python client library for the…
permissive · top 15,000 on PyPI
py-partiql-parserParses and executes PartiQL queries against…
permissive · top 5,000 on PyPI