Proposals
- rename config2.py to config.py and implement loading all global and user-defined settings
- global bot settings can be located in pywikibot/config.toml (preferred) or pywikibot/config.ini
- user-defined settings can be located in user-config.toml (preferred) or user-config.ini
- script-related settings including L10N can be located in scripts_config.toml (preferred) or scripts_config.ini
- optionally support user-config.py for backward compatibility, but mark as legacy and remove this ability later
- drop user-config.py support. This might be a great advantage using PAWS or on toolforge
- enable site-related settings e.g. from wiki page
Advantages and risks
| Feature | .toml (preferred) | .ini | user-config.py (legacy) |
|---|---|---|---|
| Safe from arbitrary code execution | ✅ Yes | ✅ Yes | ❌ No |
| Risk of malicious logic | ❌ Minimal | ❌ Minimal | ⚠️ High if untrusted input |
| Parse safety | ✅ Safe | ✅ Safe | ⚠️ Risky (uses exec or eval) |
| Flexibility / programmability | ⚠️ Limited (static values only) | ❌ Limited | ✅ Full Python power |
| Nested structures | ✅ Supported via tables/arrays | ❌ Very limited | ✅ Arbitrary |
| Datatypes support | ✅ Standardized, type-safe | ❌ Strings only, must parse | ✅ Any Python type |
| Readability / usability | ✅ Human-readable, structured | ✅ Easy for simple configs | ⚠️ Python knowledge required |
| Automation / CI/CD | ✅ Easy | ✅ Easy | ⚠️ Harder |
Disadvantages
- Python 3.11 or external toml like tomli required for the toml files