wiki-scripts documentation

The wiki-scripts project is a general framework for writing bots, maintenance scripts or performing data analysis using the MediaWiki API interface. The repository includes several scripts automating common maintenance tasks on the ArchWiki, but most of the functionality implemented in the underlying ws module is general and reusable on any MediaWiki powered wiki.

Notable features

General features of the ws module:

  • Custom interface for connecting to the MediaWiki API (ws.client).
  • Automatic handling of the CSRF token.
  • Automatic conversion of MediaWiki timestamp strings into the Python’s datetime.datetime objects and back.
  • Automatic handling of API query-continuation.
  • Class for easy handling of MediaWiki page titles (Title).
  • Custom SQL database capable of mirroring (almost) all data stored on the wiki (useful e.g. for caching of expensive queries involving revisions content).

Installation

Get the latest development version by cloning the git repository:

git clone git@github.com:lahwaacz/wiki-scripts.git
cd wiki-scripts

Alternatively download a tarball of the latest stable release.

There is no package on PyPI or any other repository yet, all dependencies have to be installed manually.

Requirements

The following are required only by some scripts:

  • WikEdDiff (for highlighting differences between revisions in interactive mode)
  • Pygments (alternative highlighter when WikEdDiff is not available)
  • pyalpm (for update-package-templates.py)
  • NumPy and matplotlib (for statistics_histograms.py)

Optional dependencies:

Dependencies for running the tests:

Other tools used for development:

Acknowledgement

There is a list of client software maintained on mediawiki.org, many of them are quite inspirational.

Indices and tables