Manual:Pywikibot/Development

How to report a bug
When you report a bug, please try to include:


 * What Pywikipediabot version you are using. We recommend that you test if the bug is still present in [//git.wikimedia.org/summary/pywikibot%2Fcore.git the latest available revision, as stored in Git].
 * Python version (do  to check) and operating system you use (e.g. Windows, Linux, Mac OS...).
 * To do that, version.py will be useful.
 * A nice summary.
 * A full description of the problem/report.
 * How to reproduce the bug, with full information (script, command line, family, and language used).
 * The console output provided by the script (included the Python traceback if you are reporting a crash).

To submit a new bug, visit the [//bugzilla.wikimedia.org/buglist.cgi?bug_status=__open__&product=Pywikibot bug tracker].

Development
If you have thought of a function you want to have, and none of the bots provides it yet, you can ask one of the programmers to write it for you. Or even better, you can try to work on the bots yourself. Python is a nice language, and not hard to learn. We will welcome you.

Commit access
Anyone can get Developer access. Once you've registered, if you're interested in working on pywikipedia, please email the mailing list and introduce yourself and mention what you'd like to work on, so other people can greet you.

Working with source code
and after modifying the code, follow the steps in Gerrit/Tutorial.
 * How to submit patches: configure Git and Gerrit. Follow steps in Gerrit/Getting started and run this:

Example (step-by-step)
So for example if you want to work with compat (formerly known as trunk), do the following, step-by-step:
 * 1) setup your software:
 * 2) if not done already for svn access; create an SSH key, a developer account and add your public key to gerrit as well as to wikitech
 * 3) install 'git' package
 * 4) install 'git-review' package (the one by openstack, NOT the one by Facebook)
 * 5) clone and setup your repo:
 * 6) clone the git repo with all submodules by using (like  )   and wait, this step will take some time
 * 7) enter the directory
 * 8) config git setting for this repo/directory only (not global, in case e.g. you have different pseudo for multiple projects)   and   in order to configure this globally, use the   parameter
 * 9) config your terminal/console to output english messages (in order to work properly with git review, see Gerrit/git-review)   this has to be done every time a new console is started, in order to configure this permanently, put this into your   or similar setup file
 * 10) setup git review for this repo only   and enter your   again, this is an important step - if you forget it, according to Gerrit/Tutorial, the final   below (needed to commit your changes for review) will fail - though this can be still solved then
 * 11) work with the repo, e.g. commit patches for review:
 * 12) switch to the master branch (might not be needed)
 * 13) update the current branch to revision online (like  )
 * 14) create your own local temporary branch for working   and try to choose a   with the help of the branch naming tips available
 * 15) now write some code; see the Git commands add, rm and mv to add, remove or rename files - when you're ready go to the next step
 * 16) commit your changes to your local temporary branch with   (you can use   instead of   and   instead of  ) and, as used from svn, enter a meaningful commit message, e.g. a short description of your code changes
 * 17) * See Gerrit/Commit message guidelines.
 * 18) optionally, check your changes by looking at the committed data   and make sure that you are sending what you wanted to
 * 19) send the data to the online repository, resp. gerrit for review (like  )
 * 20) finally go to Gerrit, click on your change and write a reviewer's name in the input box near the "Add Reviewer" button

Documentation
This is the user and developer manual, as can be found on Manual:Pywikibot, please help keeping it updated.

The code itself is partly documented as well with help of doxygen. You can find them, e.g. at: as well as unit test code coverage reports at:
 * compat
 * core (n/a yet)
 * compat
 * core (n/a yet)

Bot & Proxy
Core: Add the following lines to user-config.py:

Compat: Add the following line to your user-config.py:

Debugging network issues
See Pywikibot/mitmproxy for tips.