User:Usernamekiran/Toolforge pywikibot tutorial

This is a guide for setting up a Pywikibot on Toolforge. I had some difficulty using MediaWiki and Wikitech tutorials to set up a bot on Toolforge. I think there is a big learning curve, but the tutorials/help-pages at Wikitech/Mediawiki are somewhat confusing, and sometimes self-contradictory. These are my streamlined notes that will hopefully help the next person.

This tutorial discusses solely about Pywikibot, after setting up basic necessities like creating ToolForge account, generate an SSH key, setting FTP client for Toolforge, among few other things. These things are required if you run any bot from Toolforge.

As a supplement to this tutorial, there is another guide which extnsively covers the use of user-fixes.py Fixes.py and user-fixes.py are auxiliary files of replace.py, the text manipulating utility of Pywikibot framework. They are useful for advanced use of replace.py; both contain so-called "fixes", i.e. predefined text replacement tasks.

Running a pywikibot can be divided in three major steps:

  • Creating an account on toolforge.
  • Installing the pywikibot in your tool directory (of toolforge, this will become clear later).
    • Before running the bot from toolforge, it is highly recommended to install the bot on your computer, and do as much testing as possible in your own userspace.
    • After the testing from your computer, it is again recommended to test the bot from toolforge in your userspace.
  • Managing bot related files on server from your end (for Windows: SSH client (for commands), and FTP client for transferring/managing files).

Bot vs user script edit

First of all, you need to find out whats more suitable for your task: a user script, or a bot?
To keep this tutorial brief, and on point the bot vs script comparison can be found at User:Novem Linguae/Essays/Toolforge bot tutorial#Bot or user script?.

Creating an account on toolforge edit

  • to be updated soon