Manual:Pywikibot/Development
96px |
Pywikibot |
---|
- If you need more help on setting up your Pywikibot visit the IRC channel
#pywikibot
connect @ freenode server or Pywikibot mailing list.
Contents
How to report a bug[edit | edit source]
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 the latest available revision, as stored in Git.
- Python version (do
python -V
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 bug tracker.
Development[edit | edit source]
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[edit | edit source]
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[edit | edit source]
- How to submit patches: configure Git and Gerrit. Follow steps in Gerrit/Getting started and run this:
#for hacking core git clone ssh://USERNAME@gerrit.wikimedia.org:29418/pywikibot/core.git
and after modifying the code, follow the steps in Gerrit/Tutorial.
Example (step-by-step)[edit | edit source]
So for example if you want to work with compat (formerly known as trunk), do the following, step-by-step:
- setup your software:
- if not done already for svn[1] access; create an SSH key, a developer account and add your public key to gerrit as well as to wikitech
- install 'git' package
- install 'git-review' package (the one by openstack [1], NOT the one by Facebook)
- clone and setup your repo:
- clone the git[2] repo with all submodules by using (like
svn checkout
)$ git clone --recursive ssh://USERNAME@gerrit.wikimedia.org:29418/pywikibot/compat.git pywikipedia-git
- enter the directory
$ cd pywikipedia-git
- config git setting for this repo/directory only (not global, in case e.g. you have different pseudo for multiple projects)
$ git config user.email "EMAIL"
$ git config user.name "USERNAME"
--global
parameter - config your terminal/console to output english messages (in order to work properly with git review, see Gerrit/git-review#Troubleshooting)
$ alias git="LANG=C git"
bashrc
or similar setup file - setup git review for this repo only
$ git review -s
USERNAME
again, this is an important step - if you forget it, according to Gerrit/Tutorial#Push your change set to Gerrit, the finalgit review
below (needed to commit your changes for review) will fail - though this can be still solved then
- clone the git[2] repo with all submodules by using (like
- work with the repo, e.g. commit patches for review:
- switch to the master branch (might not be needed)
$ git checkout master
- update the current branch to revision online (like
svn update
)$ git pull
- create your own local temporary branch for working
$ git checkout -b MEANINGFUL_BRANCH_NAME
MEANINGFUL_BRANCH_NAME
with the help of the branch naming tips available - 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
- commit your changes to your local temporary branch with
$ git commit --all # In the Gerrit world you can do this only once per branch! Remember to follow the commit message guidelines.
-a
instead of--all
and-R
instead of--no-rebase
) and, as used from svn, enter a meaningful commit message, e.g. a short description of your code changes - optionally, check your changes by looking at the committed data
$ git show HEAD
- send the data to the online repository, resp. gerrit for review (like
svn commit
)$ git review
- finally go to Gerrit, click on your change and write a reviewer's name in the input box near the "Add Reviewer" button
- switch to the master branch (might not be needed)
Documentation[edit | edit source]
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:
- compat
- core (n/a yet)
as well as unit test code coverage reports at:
- compat
- core (n/a yet)
Bot & Proxy[edit | edit source]
Core: Add the following lines to user-config.py:
import httplib2, socks proxy = httplib2.ProxyInfo(socks.PROXY_TYPE_HTTP, 'localhost', 8080)
Compat: Add the following line to your user-config.py:
proxy = {'host': 'localhost:8080', 'auth': None}
Debugging network issues[edit | edit source]
See Pywikibot/mitmproxy for tips.
See also[edit | edit source]
- (SVN) Code Review - MediaWiki: Special:Code/pywikipedia
- (GIT) gerrit.wikimedia Code Review: https://gerrit.wikimedia.org/r/#/admin/projects/pywikibot
References[edit | edit source]
- ↑ Book: Version Control with Subversion for Subversion 1.7. http://svnbook.red-bean.com/
- ↑ Book: Pro Git. http://git-scm.com/book