Manual:Pywikibot/Development

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


 * PyWikipediaBot version in use. It's recommended to test if the bug is still present in latest SVN revision available.
 * Python version (python -V) and operating system you use (e.g. Windows, Linux, MacOS...)
 * For above purpose, version.py will be useful.
 * A nice summary
 * Full description of the problem/report
 * How to reproduce bug 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 bug tracker provided by SourceForge.

Development
If you have a function you want to have a bot for that is not yet provided by one of the bots, 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
To request commit access, first email the mailing list and explain what you'd like to work on. Once you've gotten a little community consensus that you should get access, submit a formal commit access request and mention that you'd like pywikipediabot commit access, and point to the mailing list thread where you got an OK from the pywikipediabot community. Example.

Tips
Here and in wikipedia.py, there are some very basic tips for getting started writing your own bot:
 * be sure you've set up your user-config.py file (see above)
 * To gain access to the pywikipedia framework, use:
 * to retrieve a page, use the following, where pageName is, e.g., "Wikipedia:Bots" or "India":
 * to update a page, use:
 * look at some of the pywikipedia files for other ideas -- basic.py is relatively easy to read even if you're new to pywikipedia.
 * you can find all available Page methods in the wikipedia.py file.
 * basic.py gives you a setup that can be used for many different bots, all you have to do is define the string editing on the page text.
 * To iterate over a set of pages, see pagegenerators.py for some objects that return a set of pages. An example use of the CategoryPageGenerator that does something for each page in the Category:Living people category:

Contributing changes
If you changed the bot and want to send a patch to the maintainer,
 * 1) Update to the current version (it will merge your changes with the improvements already committed to the SVN Repository),
 * 2) Resolve any conflicts caused by the update (grep for "=====" ;-) and
 * 3) Type:
 * $ svn diff > svn.diff

Review the diff to ensure it only includes the changes you want to contribute. The lines at the beginning starting with "?" should be removed.

If you are in direct contact with a Pywikipediabot developer, you can send the file svn.diff to him, but preferably attach the patch to a ticket in the Pywikipedia bug tracking system.

Git
See this mailing list post if you would like to try Git instead of Subversion for source control. This github repo mentioned is quite dated, the best part is this git svn command: git svn clone http://svn.wikimedia.org/svnroot/pywikipedia/ -T trunk -b branches Note that this will take quite a while.

SVN
All prerequisites are the same as for Git access. Then checkout the code from wikimedia svn server by using your ssh account there: svn co svn+ssh://USERNAME@svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia/ pywikipedia for trunk and svn co svn+ssh://USERNAME@svn.wikimedia.org/svnroot/pywikipedia/branches/rewrite/ rewrite for rewrite.

After that you can change the code and afterwards submit those modifications by a simple: svn ci

Bot & Proxy
There is probably (not tested!) draft workaround described here.