Page MenuHomePhabricator

Port commonscat.py to Pywikibot core
Closed, ResolvedPublic

Description

PyWikibot [1] is a Python-based framework to write bots for MediaWiki. There are currently 2 versions of pywikibot currently used:

  • version 1.0 (also known as pywikibot-compat) is the legacy version
  • version 2.0 (also known as pywikibot-core) is a rewrite of the original framework, focusing solely on MediaWiki wikis with an API (version 1.14 or newer) and offering an improved internal architecture.

There are a number of scripts used by various robot operators that were used in pywikibot-compat but have not yet been adapted to work with pywikibot-core. One of those is commonscat.py, which allows you to add the template {{commonscat}} (a link to a category from Wikimedia Commons) to categories. The tool works by following the interwiki links. If the template is present on another langauge page, the bot will use it.

You can find information about how to convert the script on [2], [3]. Patches can be submited through the gerrit uploader [4] (you need a MediaWiki.org account). More documentation on gerrit can be found at [5].

[1] https://www.mediawiki.org/wiki/Manual:Pywikibot
[2] https://www.mediawiki.org/wiki/Manual:Pywikibot/2.0/Conversion
[3] https://www.mediawiki.org/wiki/Manual:Pywikibot/i18n_conversion
[4] https://tools.wmflabs.org/gerrit-patch-uploader/
[5] http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Gerrit


Version: unspecified
Severity: normal
Whiteboard: gci2013 https://www.mediawiki.org/wiki/Google_Code-In#Candidate_tasks

Details

Reference
bz56774

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:19 AM
bzimport set Reference to bz56774.
Strainu created this task.Nov 8 2013, 1:26 PM

pyfisch wrote:

I will convert the script to core.

(In reply to comment #1)

I will convert the script to core.

Hi pyfish. This bug was logged as a Google CodeIn task. I think it would be preferable to leave it to one of the students.

If this depends on bug 56873, doesn't bug 56873 need to be fixed first (it's not marked as a GCI task)?

Bug 56873 was just added by pyfish. I don't really think it's blocking the port, since you can always test with a wiki which does *not* throw an error. I would call 56873 as relevant to this one, not blocking. Still, it would be great if we could get if fixed befor GCI.

pyfisch wrote:

Sorry, I did not see that it should not be fixed by normal users. I uploaded a patch with my already done work (converting add_text.py) to this bug. https://gerrit.wikimedia.org/r/#/c/94623/

I am myself a student, so I could participate in Google Code-In and solve it there. :-P

JAnD added a comment.Nov 11 2013, 8:10 AM

It would be useful to change this script in both co[mpat|re] for work with wikidata siltelink and P373 too.

When is on page not {{commonscat}}, look to wikidata first, then on commons and add new template, if exists anywgere

(In reply to comment #5)

I am myself a student, so I could participate in Google Code-In and solve it
there. :-P

If you fit the GCI requirements, that is indeed possible.

(In reply to comment #6)

It would be useful to change this script in both co[mpat|re] for work with
wikidata siltelink and P373 too.
When is on page not {{commonscat}}, look to wikidata first, then on commons
and
add new template, if exists anywgere

Would you mind logging another bug for that? We can also add it as a GCI task.

Restricted Application added a subscriber: Cyberpower678. · View Herald TranscriptJun 29 2018, 3:17 PM