skillfed

pywikibot

Python MediaWiki Bot Framework

pywikibot v11.6.0 321.1K downloads/30d#7,625 on PyPI767
Permissive license MIT Active released

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 pywikibot

uv

uv add pywikibot

poetry

poetry add pywikibot

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersNatural Language :: AfrikaansNatural Language :: ArabicNatural Language :: BasqueNatural Language :: BengaliNatural Language :: BosnianNatural Language :: BulgarianNatural Language :: CantoneseNatural Language :: CatalanNatural Language :: Chinese (Simplified)Natural Language :: Chinese (Traditional)Natural Language :: CroatianNatural Language :: CzechNatural Language :: DanishNatural Language :: DutchNatural Language :: EnglishNatural Language :: EsperantoNatural Language :: FinnishNatural Language :: FrenchNatural Language :: GalicianNatural Language :: GermanNatural Language :: GreekNatural Language :: HebrewNatural Language :: HindiNatural Language :: HungarianNatural Language :: IcelandicNatural Language :: IndonesianNatural Language :: IrishNatural Language :: ItalianNatural Language :: JapaneseNatural Language :: JavaneseNatural Language :: KoreanNatural Language :: LatinNatural Language :: LatvianNatural Language :: LithuanianNatural Language :: MacedonianNatural Language :: MalayNatural Language :: MarathiNatural Language :: NepaliNatural Language :: NorwegianNatural Language :: PanjabiNatural Language :: PersianNatural Language :: PolishNatural Language :: PortugueseNatural Language :: Portuguese (Brazilian)Natural Language :: RomanianNatural Language :: RussianNatural Language :: SerbianNatural Language :: SlovakNatural Language :: SlovenianNatural Language :: SpanishNatural Language :: SwedishNatural Language :: TamilNatural Language :: TeluguNatural Language :: ThaiNatural Language :: TibetanNatural Language :: TurkishNatural Language :: UkrainianNatural Language :: UrduNatural Language :: VietnameseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: GraalPyProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP :: Dynamic Content :: WikiTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

mediawiki api clientwikipedia bot frameworkwikidata access pythonwiki page automationmediawiki editing librarywikibase python clientwiki content management
wiki-automationmediawiki-apiwikidata

More Python Modules packages