Page MenuHomePhabricator

Make a pywikibot entry point for scripts
Open, LowPublic


Currently most scripts in pywikibot are just in the scripts/ folder. It may make sense to create a console script named pwb and then configure things to run using something simple like pwb <scriptname> irrespective of the folder location and so on.

This way, other users can simply make a pywikibot-<script_name> package on pypi and it can be linked to pwb as a plugin with entry points. Hence, it gives pywikibot the ability to make "plugins" which are run using a unified interface.

Check out how pytest does it to get a better idea:

Event Timeline

AbdealiJK created this task.Jul 1 2016, 5:25 AM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJul 1 2016, 5:25 AM
Restricted Application added a subscriber: pywikibot-bugs-list. · View Herald TranscriptJul 1 2016, 5:25 AM
AbdealiJK updated the task description. (Show Details)Jul 1 2016, 5:31 AM
jayvdb added a comment.Jul 1 2016, 4:49 PM

This concept needs to be fleshed out some more. If it is only the scripts in pywikibot-core repo, T139144: Making a pypi package pywikibot-scripts for officially supported scripts would be the correct approach, and the current script is probably not very useful for that.

If it is goes to support other scripts, that are separate packages, how will it find them?

One approach is to create a PEP420 namespace, but that doesnt work in Python 2. For T104130: Family packages, has a Python 2 mechanism that replicates PEP420 behaviour. Maybe I should extract that out into a separate package, and then it can be used for scripts also.

Another approach is to register the scripts as plugins using setuptools (like flake8 v2).

Other ideas?

The library does need a mechanism to create a, and that could be a console script in the pywikibot package, and could simply be the existing

Related patches are:

Xqt added a subscriber: Xqt.Jul 14 2017, 11:45 AM

Isn't this the same as in T139141 ?

Xqt triaged this task as Low priority.Sep 27 2018, 2:11 PM
This comment was removed by Dvorapa.
Restricted Application added a subscriber: RhinosF1. · View Herald TranscriptDec 21 2019, 7:25 AM
Dvorapa added a comment.EditedDec 21 2019, 7:35 AM

Isn't this the same as in T139141 ?

No, T139141 is about T107629 (merged those two)