|This page is documentation for Pywikipedia Compat, which is no longer supported. このページは歴史的な興味のため保持されています。 It may document scripts and features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date.|
Python version 2.7.2 or higher is strictly recommended for Wikimedia projects using the Compat branch.
Two versions of pywikibot
There are two branches under active development. You can choose between:
- Core (formerly rewrite), which should be your first choice. If you don't know what to choose, take this branch.
- Compat (formerly trunk) is an older version of the framework that is not actively maintained.
There are limit scenarios where it might still be useful. Compat was able to edit on MediaWiki 1.13 and earlier, even before MediaWiki had an API, and it includes a few scripts that are not available on core yet (see the compatibility list). However, if are going to edit WikiMedia wikis, compat is deprecated.
Download Pywikibot with Git
- For compat (formerly "trunk")
git clone --recursive https://gerrit.wikimedia.org/r/pywikibot/compat.git
- For compat (formerly trunk)
svn co https://github.com/wikimedia/pywikibot-compat/trunk compat cd compat svn co https://github.com/wikimedia/pywikibot-i18n/trunk i18n
To update the code for compat branch:
svn up compat/trunk cd compat svn up i18n
The pywikibot framework is quite a big and complex code and some scripts needs external python modules (libraries) from other sources also in order to work properly. The dependencies can be installed manually or automatically (not supported by core yet). If any issues arise during installation (of dependencies) please file a bug report or write to the pywikipedia-l maillist.
If available this is the recommended way, because this will result in an identical setup on all machines.
All you have to do is just execute your favorite script after installation (for example,
python pwb.py clean_sandbox.py -simulate) and pywikibot will ask you whether you want to install missing packages, and continue to ask questions on how you want to configure your local copy.
Packages will be installed from OS package management if possible (all Linux, not under win).
If they cannot be found they will be downloaded as archive from original source, extracted and installed.
In the course of this process a few packages have to be slightly modified in order to work seamlessly with pywikibot.
This modification needs an additional binary tool called patch (patch.exe under win).
Unfortunately this is not available from MS; however, we can use a port of the original linux code (gnuwin32 patch.exe)
It is worth mentioning here that - despite the OS package management "install mode" - all files are installed locally into the
externals/ directory of pywikibot.
This is a very useful feature for users that do not have permission to install software to their system, e.g. non-admins.
Manual (for experts)
In order to install the needed packages manually, you first need to know which ones. A full list of all needed modules can be found in externals/__init__.py and contains:
- framework core code:
- i18n [git submodule]
- spelling [git submodule]
- httplib2 [git submodule]
- BeautifulSoup.py [included since important]
- depending of which script will be used:
- opencv, opencv/haarcascades [git submodule]
- pycolorname [git submodule]
- jseg, jseg/jpeg-6b
- (bob, xbob_flandmark)
Which ones you really need, depends strongly on the script you intend to run - if you are unsure use the automatic mode above. In order to check correct installation just run a bot script. If the dependencies are satisfied everything will be ok, else the framework will complain and ask whether it should install missing packages automatically.
- For compat release (formerly trunk)
- Right-click on your prefered directory and execute
"URL of repository"and paste the URL
"Checkout directoryand change the default directory which is
<your preferred directory>/pywikibot-compate.g. to
<your preferred directory>/svn-compatif you like.
- Confirm with
[ OK ]
- Now we have to install external libraries used by the framework.
There are different ways to do that e.g. again with the checkout command. Another way is using properties in a similar way as in core release.
Install the bot code
$ git clone --recursive https://gerrit.wikimedia.org/r/pywikibot/compat.git pywikibot-compat
Now, as similarly described in the core section above, you have to setup pywikibot. Choose any one of the following processes to configure your system:
- Run your favorite bot script (e.g.
python pwb.py clean_sandbox.py -simulate) since you are doing this in a fresh clone, it will trigger a bunch of questions on how you want to configure your local copy, answer them carefully in order to proceed.
- If you already have a config file(s) from a previous version, you can copy those existing files into the right places (e.g. pywikibot-compat/).
See this article for more details on configuring your bot including creating the files manually. You may setup all externals manually if you want - but this is not needed in compat, confer Manual:Pywikipediabot/Installation#Dependencies for further info. You will also have to enter the password for your bot eventually. Now you have finished the configuration of compat and can continue setting up the webspace and jobs to execute.