saper created this task. saper added a subscriber: saper. saper added a project: Pywikibot-General. Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION I run my bots in a fairly constrained and controlled environment (minimal software configuration, constrained permissions and network traffic) and I am running into problems like pywikibot trying to guess the version number.
I have proposed a Gerrit change to [override User-Agent](https://gerrit.wikimedia.org/r/#/c/208842/). Apparently `pywikibot-core` has a `config.user_agent_format` feature but it does not prevent auto-discovery of the bot version.
Overriding User-Agent is not enough since there may be more features checking the version, one of them is `writeToCommandLogFile()` (see also {T98106}).
When git is not available, it tries to fetch the irrelevant changelog, as I usually have some local patches/commits in the code. (Fetching also fails with {T98104}).
This feature is just not robust enough in my experience.
TASK DETAIL https://phabricator.wikimedia.org/T98107
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: saper Cc: pywikipedia-bugs, saper, Aklapper
jayvdb added a subscriber: jayvdb. jayvdb added a comment.
Core has a config variable log_pywiki_repo_version = False . That could be useful for https://phabricator.wikimedia.org/T98106
Regarding the user-agent, core http layer provides a few values to the user agent formatter, including pywikibot.__release__ (which is not the auto discovered version), but also includes the auto-discovered data in pywikibot.version.cache **only** if it is set. (see http.py line 184). That implicitly means it doesnt use the git version when log_pywiki_repo_version is False
We could improve the user agent so that it explicitly fetches pywikibot.version data when '{revision}' or '{version}' are in the user agent format string, and explicitly doesnt fetch that version when those are omitted from the user agent string.
TASK DETAIL https://phabricator.wikimedia.org/T98107
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: jayvdb, saper, Aklapper, pywikipedia-bugs
XZise added a subscriber: XZise. XZise added a comment.
But when it generates the user agent string in core it doesn't fetch the version of pwb. So it seems unrelated to the user agent string.
Anyway we could use some classes or so which have a __str__ and lazy load the version number. So if there is no {version} in the string str.format won't do str(…) on that (hopefully). I'll test that.
TASK DETAIL https://phabricator.wikimedia.org/T98107
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise Cc: XZise, jayvdb, saper, Aklapper, pywikipedia-bugs
XZise added a comment.
Okay with https://phabricator.wikimedia.org/rPWBC654501961205505b906224ce6f67054c3275c... merged not adding `{version}` and `{revision}` to the user-agent format string it won't query the version number. So the question is what this bug report is about and if it actually did fix this bug (for pywikibot-core).
TASK DETAIL https://phabricator.wikimedia.org/T98107
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise Cc: XZise, jayvdb, saper, Aklapper, pywikipedia-bugs
jayvdb edited projects, added Pywikibot-network; removed Pywikibot-General. jayvdb set Security to None.
TASK DETAIL https://phabricator.wikimedia.org/T98107
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: XZise, jayvdb, saper, Aklapper, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org