--- id: mwparserfromhell version: "0.7.2" license: MIT license_treatment: permissive maintenance: active --- # mwparserfromhell — MWParserFromHell is a parser for MediaWiki wikicode License: permissive · Maintenance: active · Downloads: 906.9K/mo ## What it is and what it does mwparserfromhell is a parser for MediaWiki wikicode that converts raw wiki markup into a queryable object model. It provides methods to extract templates, links, sections, and other wiki elements from page text, and allows you to modify them programmatically before converting back to plain wikitext. The parser includes a fast compiled C tokenizer for most platforms, with an automatic fallback to pure Python if compilation fails. The package is designed for direct source-code analysis rather than HTML rendering, which means it works with the raw wikitext as written. It handles nested structures (templates within templates, for example) and provides filtering and matching methods that account for MediaWiki conventions like case-insensitive template names. Common use cases include bot automation, content analysis, and wiki page editing workflows. Use it for: - Extract and analyze all templates from a Wikipedia article to audit template usage or gather metadata. - Modify template parameters programmatically in bulk wiki edits, such as updating deprecated template syntax across pages. - Parse wiki markup to identify links, categories, and sections for content extraction or validation tasks. - Build bots that read, analyze, and edit wiki pages by parsing the raw wikitext before and after modifications. - Validate or normalize wikicode structure without rendering to HTML, useful for linting or preprocessing workflows. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses MediaWiki wikicode into a queryable syntax tree, allowing you to extract, analyze, and modify templates, links, and other wiki markup elements programmatically. Yes. The package is actively maintained, has no known vulnerabilities, supports current Python versions (3.9+), and offers prebuilt wheels for common platforms. MIT licensing is permissive. Install friction is moderate due to the C extension, but fallback to pure Python is automatic. Recommended for any project that needs to parse or manipulate MediaWiki wikitext. ## Install pip install mwparserfromhell uv add mwparserfromhell poetry add mwparserfromhell ## Installing mwparserfromhell Before you install: Medium install friction due to a compiled C tokenizer extension, but prebuilt wheels are available for common platforms (Linux x86_64 and arm64, macOS x86_64 and arm64, Windows x86 and x86_64). Falls back to pure-Python implementation if the C extension cannot be built. Active maintenance with recent commits. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions. Quickstart: pip install mwparserfromhell import mwparserfromhell wikicode = mwparserfromhell.parse("{{template|param=value}}") templates = wikicode.filter_templates() print(templates[0].name) Requires Python 3.9 or later. If building from source and the C tokenizer extension fails to compile, set environment variable WITH_EXTENSION=0 to use the slower pure-Python fallback. Verify before relying: - Performance characteristics and parsing speed compared to pure-Python implementation when C extension is unavailable. - Exact scope of MediaWiki syntax variants and edge cases the parser handles beyond the documented limitations. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 906.9K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags mediawiki parser, wikicode parsing, wikipedia text parsing, wiki template extraction, wikitext parser, mediawiki syntax parser, wiki markup parser, wiki-parsing, mediawiki, wikitext [View on SkillFed](https://skillfed.io/packages/mwparserfromhell) · [View on PyPI](https://pypi.org/project/mwparserfromhell/)