Please check out the contribution guide (CONTRIBUTION.md) before making any contributions.
PendingChangesBot is a Django application that inspects pending changes on Wikimedia projects using the Flagged Revisions API. It fetches the 50 oldest pending pages for a selected wiki, caches their pending revisions together with editor metadata, and exposes a Vue.js interface for reviewing the results.
-
Fork the repository
- A fork is a new repository that shares code and visibility settings with the original “upstream” repository. Forks are often used to iterate on ideas or changes before they are proposed back to the upstream repository.
- For more details about how to fork a repository, please check out the github docs for it.
-
Clone the repository
- Using SSH (requires setup of ssh keys)
git clone git@github.com:Wikimedia-Suomi/PendingChangesBot-ng.git cd PendingChangesBot-ng- Using HTTPS
git clone https://github.com/Wikimedia-Suomi/PendingChangesBot-ng.git cd PendingChangesBot-ng -
Check your python version (recommended)
- On Windows:
python --version
- On macOS / Linux:
python3 --version
Install if not found *for python3 you need to install pip3
-
Create and activate a virtual environment (recommended)
python3 -m venv venv source venv/bin/activate # On Windows use: .venv\\Scripts\\activate
-
Install Python dependencies
- On Windows:
pip install --upgrade pip pip install -r requirements.txt
- On macOS / Linux:
pip3 install --upgrade pip pip3 install -r requirements.txt
-
Install pre-commit hooks (recommended for contributors)
pre-commit install
This will automatically format and lint your code before each commit.
Pywikibot needs to log in to meta.wikimedia.org and approve
Superset's OAuth client before the SQL queries in SupersetQuery will succeed. Follow
the steps below once per user account that will run PendingChangesBot:
-
Move to app directory All pywikibot and manage.py commands should be run in the app directory.
cd app -
Create a Pywikibot configuration
echo "usernames['meta']['meta'] = 'WIKIMEDIA_USERNAME'" > user-config.py
-
Log in with Pywikibot
- Using management command
python manage.py auth_with_username_and_password
- On Windows:
python -m pywikibot.scripts.login -site:meta
- On macOS / Linux:
python3 -m pywikibot.scripts.login -site:meta
The command should report
Logged in on metawikiand create a persistent login cookie at~/.pywikibot/pywikibot.lwp. -
Approve Superset's OAuth client
- While still logged in to Meta-Wiki in your browser, open https://superset.wmcloud.org/login/.
- Authorize the OAuth request for Superset. After approval you should be redirected to Superset's interface.
cd appOn Windows:
python manage.py makemigrations
python manage.py migrate- On macOS / Linux:
python3 manage.py makemigrations
python3 manage.py migrateThe Django project serves both the API and the Vue.js frontend from the same codebase.
cd app- On Windows:
python manage.py runserver- On macOS / Linux:
python3 manage.py runserverOpen http://127.0.0.1:8000/ in your browser to use the interface. JSON endpoints are
available under /api/wikis/<wiki_id>/…, for example /api/wikis/1/pending/.
Unit tests live in the Django backend project. Run them from the app/ directory so Django can locate the correct settings module.
cd app- On Windows:
python manage.py test- On macOS / Linux:
python3 manage.py testThis project uses Ruff for code formatting and linting.
Note: If you installed pre-commit hooks (step 5 above), formatting and linting happen automatically before each commit. You don't need to run these commands manually.
# Format code
ruff format app/
# Check and fix linting issues
ruff check app/ --fixIf you are working inside a virtual environment, ensure it is activated before executing the command.
After these steps Pywikibot will be able to call Superset's SQL Lab API without running
into User not logged in errors, and PendingChangesBot can fetch pending revisions
successfully.