pywikibot
Python MediaWiki Bot Framework
What it is and what it does
Pywikibot is a Python framework that wraps the MediaWiki API, enabling developers to automate wiki operations—reading pages, editing content, managing revisions, and querying Wikibase repositories. It abstracts the raw HTTP API into Python objects like Site, Page, and ItemPage, making it straightforward to write bots and scripts that interact with Wikipedia, Wikidata, and other MediaWiki-powered wikis.
The framework provides both low-level API access through request objects and high-level abstractions through bot classes (such as ExistingPageBot) that handle common patterns like iterating over pages and applying bulk edits. It depends on mwparserfromhell for wiki markup parsing, packaging for version handling, and requests for HTTP communication. The library supports modern Python versions (3.9–3.15) and is actively maintained by the Wikimedia community.
Use it for:
- Automate bulk edits across Wikipedia articles or other MediaWiki wikis using bot scripts
- Retrieve and process structured data from Wikidata or other Wikibase repositories
- Build custom tools to monitor page revisions, user contributions, or wiki statistics
- Parse and manipulate wiki markup (templates, links, categories) in page content
- Integrate wiki data into external applications or pipelines via the MediaWiki API
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Pywikibot is a Python framework that interfaces with the MediaWiki API to read, edit, and manage wiki pages and Wikibase repositories programmatically.
Yes. Pywikibot is a mature, actively maintained framework with no known vulnerabilities, low install friction, and permissive licensing. It is the standard choice for MediaWiki automation in Python and has a clear deprecation policy for API stability. Install it if you need to automate wiki operations or access Wikibase data programmatically.
Install
pywikibot on PyPI
pip
pip install pywikibotuv
uv add pywikibotpoetry
poetry add pywikibotInstalling pywikibot
Before you install
Low install friction with a pure-Python wheel distribution. The package is actively maintained with a recent release (23 days old) and has 767 repository stars, indicating stable ongoing development.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install pywikibot
import pywikibot
site = pywikibot.Site('en', 'wikipedia')
page = pywikibot.Page(site, 'Wikipedia:Sandbox')
page.text = page.text.replace('foo', 'bar')
page.save('Replacing "foo" with "bar"')
Requires Python 3.9 or higher. MediaWiki API version 1.31 or higher on the target wiki.
Verify before relying
- Whether the framework supports all current MediaWiki API features beyond version 1.31
- Performance characteristics when handling large-scale edits or queries across multiple wikis
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — mwparserfromhell, packaging, requests |
| Maintenance | actively maintained — 23 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 321,052/month — #7,625 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pywikibot-11.6.0-py3-none-any.whl
Keywords: API, bot, client, framework, mediawiki, pwb, pybot, python, pywiki, pywikibase, pywikibot, pywikipedia, pywikipediabot, wiki, wikibase, wikidata, wikimedia, wikipedia
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
mwclientmwclient is a Python client library for the…
permissive · top 15,000 on PyPI
wikipediaProvides simple Python access to Wikipedia…
permissive · top 5,000 on PyPI
Wikipedia-APIWikipedia-API is a Python wrapper for…
permissive · top 5,000 on PyPI
mwparserfromhellParses MediaWiki wikicode into a queryable…
permissive · top 5,000 on PyPI
mwtypesProvides standardized Python classes for…
permissive · top 15,000 on PyPI
wikitextparserParses and manipulates MediaWiki wikitext…
copyleft · top 15,000 on PyPI
pyTelegramBotAPIA Python library that wraps the Telegram Bot…
copyleft · top 5,000 on PyPI
mwcliProvides helper functions and classes for…
permissive · top 15,000 on PyPI
botbuilder-integration-aiohttpIntegrates a Microsoft Bot Framework bot into…
permissive · top 15,000 on PyPI
python-telegram-botProvides a pure Python asynchronous interface…
copyleft · top 1,000 on PyPI