Page MenuHomePhabricator

Deprecate and remove Site.alllinks() method
Closed, ResolvedPublic

Description

Deprecate and remove Site.alllinks() method and all other methods having the same impact described in T364617 like alllinks, alltransclusions, allfileusages, allredirects

Description:
The Site.alllinks() method in Pywikibot is unreliable and produces results that do not match expectations. Its underlying MediaWiki API:alllinks does obviously not guarantee proper ordering, so generators can return pages seemingly at random. This makes the method essentially unusable for deterministic tasks.

Possibly these method still works well with MediaWiki < 1.43

Problem examples:

  • alllinks(start='Link') may start with "Peter Barr" and then include titles that alphabetically precede the previous.
  • alllinks(start='A') might return "La Toma (Argentinien)" next.

Tests currently pass only because they are not strict enough to detect these inconsistencies.

References:

Proposed action:

  1. Mark Site.alllinks() as deprecated.
  2. Update documentation to warn users about its unreliability.
  3. Try to find an alternative solution
  4. Remove the method from Pywikibot framework later

Rationale:
Removing these methods prevents users from relying on broken functionality and avoids confusion caused by inconsistent API behavior.

Event Timeline

Change #1197209 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] cleanup: deprecate dysfunctional Site.alllinks method

https://gerrit.wikimedia.org/r/1197209

Xqt claimed this task.

Change #1197209 merged by jenkins-bot:

[pywikibot/core@master] cleanup: deprecate dysfunctional Site.alllinks method

https://gerrit.wikimedia.org/r/1197209

Change #1212647 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] cleanup: Remove deprecated GeneratorsMixin.alllinks, keep RST docs

https://gerrit.wikimedia.org/r/1212647

Change #1212647 merged by Xqt:

[pywikibot/core@master] cleanup: Remove deprecated GeneratorsMixin.alllinks, keep RST docs

https://gerrit.wikimedia.org/r/1212647