MediaWiki Bot Framework for Galician Projects

Framework on top of Pywikibot to operate on MediaWiki sites in Galician.

The framework includes a script to update the population data on articles about locations within Galicia.

Usage

To run any script of the framework, you must install the framework as follows:

  1. Download the source code.

  2. Install Python 3.

  3. Install on a Python 3 virtual environment:

    For example, on Linux:

    python3 -m venv venv
    . venv/bin/activate
    pip install -e .
    

    Note

    On Windows, you may optionally install colorama to enjoy colors on the command-line interface:

    pip install colorama
    
  4. Create a user-config.py file with the following content:

    family = 'wikipedia'
    mylang = 'gl'
    usernames['wikipedia']['*'] = '<Your Galician Wikipedia Username>'
    password_file = 'user-password.py'
    
  5. Create a user-password.py file as described in the PyWikiBot documentation.

    Do not prefix strings with u (e.g. u'asdf') as described in the documentation. That is for Python 2. In Python 3 you should remove it (e.g. 'asdf').

  6. Run any script. For example:

    pywikibotgl-population
    

Once these initial steps are done, to run a script again after you close the current terminal you must always first re-enable the virtual environment:

. venv/bin/activate

Development

Automated Tests

To run the automated tests:

python3 -m venv venv
. venv/bin/activate
pip install -e .
pip install pytest pytest-pylint
pytest --pylint

Internationalization and Localization

To update the translation templates:

bash utils/update-pot.sh

To update the translation files:

bash utils/update-po.sh