Page MenuHomePhabricator

Features to move from scripts to framework (tracking)
Open, LowPublic

Description

This bug is to track features that are now in specific scripts, but that should be moved to the framework.

Some examples:

  • functions in scripts that could be used more broadly (e.g. functions that work on page text could be moved to textlib)
  • parts of scripts that call the API, or some other low-level layer, directly
  • scripts that import eachother:

We have quite a few pywikibot scripts in core (https://git.wikimedia.org/tree/pywikibot%2Fcore.git/HEAD/scripts). Some of these scripts import other scripts. That shouldn't happen. These target scripts should probably be split up in a library part and a script part:

grep "from scripts import" *.py
data_ingestion.py:from scripts import upload
flickrripper.py:from scripts import upload
template.py:from scripts import replace

Most notable one is upload.py


Version: core-(2.0)
Severity: normal

Related Objects

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:24 AM
bzimport set Reference to bz58942.
bzimport added a subscriber: Unknown Object (????).

We have quite a few pywikibot scripts in core (https://git.wikimedia.org/tree/pywikibot%2Fcore.git/HEAD/scripts). Some of these scripts import other scripts. That shouldn't happen. These target scripts should probably be split up in a library part and a script part:

grep "from scripts import" *.py

data_ingestion.py:from scripts import upload
flickrripper.py:from scripts import upload
template.py:from scripts import replace

Most notable one is upload.py

That is not the full list. See https://gerrit.wikimedia.org/r/#/c/174594/

upload:

  • data_ingestion
  • flickrripper
  • imagetransfer

replace:

  • image
  • template

category:

  • casechecker
  • cfd

others:

  • commonscat imports add_text
  • cosmetic_changes imports isbn
  • misspelling imports solve_disambiguation
  • reflinks imports noreferences
  • nowcommons imports image (which imports replace) and imagetransfer (which imports upload)

And the best of all, ...

pywikibot.page imports scripts.cosmetic_changes (T76324/T76320)

That shouldn't happen.

nowcommons has always imported imagetransfer (since 2006), and has imported image since 2008.

https://mediawiki.org/wiki/Special:Code/pywikipedia/2505
https://mediawiki.org/wiki/Special:Code/pywikipedia/5343

Most of the other script inter-dependencies are of similar vintage.

Nemo_bis renamed this task from [tracking] features to move from scripts to framework to Features to move from scripts to framework (tracking).Jul 19 2015, 9:59 AM

Remaining issues when T89499 would be merged

$ grep -r "from scripts" *
scripts/casechecker.py:from scripts.category import CategoryMoveRobot as CategoryMoveBot
scripts/cfd.py:from scripts.category import CategoryMoveRobot as CategoryMoveBot
scripts/commonscat.py:from scripts.add_text import add_text
scripts/image.py:from scripts.replace import ReplaceRobot as ReplaceBot
scripts/imagecopy.py:from scripts import image
scripts/imagecopy_self.py:from scripts import imagerecat, image
scripts/misspelling.py:from scripts.solve_disambiguation import DisambiguationRobot
scripts/nowcommons.py:from scripts.image import ImageRobot as ImageBot
scripts/panoramiopicker.py:from scripts import imagerecat
scripts/reflinks.py:from scripts import noreferences
scripts/selflink.py:from scripts.unlink import BaseUnlinkBot
scripts/template.py:from scripts.replace import ReplaceRobot as ReplaceBot
scripts/watchlist.py:from scripts.maintenance.cache import CacheEntry

Change 209176 had a related patch set uploaded (by Xqt):
[bugfix] Use RangeMessage map xml file from International ISBN Agency

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

Xqt triaged this task as Low priority.Jun 19 2017, 8:04 PM

Change 209176 abandoned by Multichill:
[bugfix] Use RangeMessage map xml file from International ISBN Agency

Reason:
No response. This can always be re-opened if you plan to work on it again.

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

$ grep -riP "from scripts\.?[^ ]* import" .
./scripts/template.py:from scripts.replace import ReplaceRobot as ReplaceBot
./scripts/nowcommons.py:from scripts.image import ImageRobot as ImageBot
./scripts/cfd.py:from scripts.category import CategoryMoveRobot as CategoryMoveBot
./scripts/casechecker.py:from scripts.category import CategoryMoveRobot as CategoryMoveBot
./scripts/imagecopy_self.py:from scripts import imagerecat, image
./scripts/commonscat.py:from scripts.add_text import add_text
./scripts/misspelling.py:from scripts.solve_disambiguation import DisambiguationRobot
./scripts/imagecopy.py:from scripts.image import ImageRobot
./scripts/image.py:from scripts.replace import ReplaceRobot as ReplaceBot
./scripts/reflinks.py:from scripts import noreferences
./scripts/watchlist.py:from scripts.maintenance.cache import CacheEntry