Updates subpages of the page specified by the rootpage
variable with transclusion counts for all templates and modules on the wiki specified by the lang
variable. If you want to specify the wiki via the command line, see User:Ahechtbot/sandbox/transclusioncount.py
This script must be run on toolforge, with both Pywikibot
and the toolforge
libraries installed. Pywikibot also relies on the requests
library and either mwparserfromhell
or wikitextparser
. See:
See the following for setting up Toolforge to run python jobs:
When creating the bootstrap_venv.sh file as described above, include the following five lines:
pip install toolforge
pip install pywikibot
pip install "mwparserfromhell>=0.5.0"
pip install "wikitextparser>=0.47.5"
pip install "requests>=2.20.1"
and, after running chmod ug+x bootstrap_venv.sh
, run the bootstrap script using the following
command that specifies the python3.9
image:
toolforge jobs run bootstrap-venv --command "cd $PWD && ./bootstrap_venv.sh" --image python3.9 --wait
To run automatically, use the following command, again specifying python3.9
:
toolforge jobs run transclusioncount --command "pyvenv/bin/python scripts/transclusioncount.py" --image python3.9 --schedule "00 12 * * SUN"
I would recommend changing 00 12
to a random time, to avoid running when lots of other scripts are using server resources .