Page MenuHomePhabricator

Pywikibot: Insufficient documentation
Closed, DeclinedPublic

Description

Some observations while developing workshop materials around Pywikibot as part of the Small-Wiki-Toolkits initiative:

Docs targeting bot users
https://www.mediawiki.org/wiki/Manual:Pywikibot/Scripts

  • Documents kept only for historical purposes are still linked from the "scripts" page.
  • Some pages do not demonstrate the use of essential parameters / arguments well
    • The watchlist script documentation says "there appears to be no arguments which can be used with it. Just type python pwb.py watchlist. However the syntax example in scripts/watchlist.py has this python pwb.py watchlist [-all | -count | -count:all | -new]. Though command line flags are technically different from command line arguments, can this made more explicit?
  • Some pages still use options or parameters that are deprecated
  • Some scripts are even missing pages and still appear in red links on the landing page
  • Scripts categorization needs a review and overhaul. For example, some scripts that do category work (e.g., 'category.py') are placed under the "Main bot scripts" section when they should be under the "Categories" section.

Docs targeting bot developers

See also

Event Timeline

IMHO this should be declined and split into separate tasks with specific pages listed, because catch-alls are way way harder to ever get resolved. See also T288833. Edit: Looks like this task had more background and momentum than I assumed when writing my comment. Sorry!

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

[pywikibot/core@master] [doc] Fix library usage description

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

Change 790791 merged by jenkins-bot:

[pywikibot/core@master] [doc] Fix library usage description

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

The lead documentation is on https://doc.wikimedia.org/pywikibot because it is generated from the code automatically.
See also: https://www.mediawiki.org/wiki/Project:Pywikibot/Documentation_RFC#Options
Maybe the MediaWiki pages should link to the corresponding doc pages or they should be synchronized somehow.

Docs targeting bot users

For the script package and scripts description and usage refer https://doc.wikimedia.org/pywikibot/stable/scripts/index.html.

Docs targeting bot developers

  • Need simple documentation for bot writers

There is a basic.py script sample shipped with the framework, see https://doc.wikimedia.org/pywikibot/master/library_usage.html#basic-script

  • Need more code samples around available classes and methods on MediaWiki.org.

I think this should be documentend within the code itself; doctests ensures that the samples are right

Samples:

komla updated the task description. (Show Details)

As an idea for sync code documentation with mw manual see T194714

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

[pywikibot/core@master] [doc] Expand module index

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

Change 818612 merged by Xqt:

[pywikibot/core@master] [doc] Expand module index

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

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

[pywikibot/core@master] [doc] Expand module index for logging, scripts, site and time module

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

Change 818616 merged by Xqt:

[pywikibot/core@master] [doc] Expand module index for logging, scripts, site and time module

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

Xqt updated the task description. (Show Details)

@Ayush_Anand3310: I think it would be a good idea to create one or several subtasks when working on this.

@Xqt So what you are saying is that I should solve each subtask individually and keep submitting it one by one?

@Xqt So what you are saying is that I should solve each subtask individually and keep submitting it one by one?

Yes. that’s my proposal.

KBach subscribed.

I'll work on this as part of T322217.

KBach triaged this task as Medium priority.Feb 15 2023, 3:03 PM

Reviewed a few scripts (IRC related) and speedy_delete that were the only one no longer supported and not mentioned in the "Outdated compat scripts" section. So, I've moved them.

@srishakatux does Pywikibot Cookbook solve the point about needing simple documentation for bot writers?

@KBach Wow, the cookbook is new and very interesting. From a quick look, yes, it does.

But is it complete and covers all necessary use cases, available classes & methods, and should some of the subpages that live at Manual: Pywikibot/ (e.g., Manual:Pywikibot/Create_your_own_script) be merged into the CookBook is what I am wondering about. With the latter, it might also be easy to distinguish between the docs living in these two places. For example, each page in the CookBook can be a more detailed explanation of all the use cases and code samples to demonstrate how to use the framework. While the docs that live at Manual:Pywikibot/ could be a shorter version of API documentation covering all available actions, arguments, how to use commands, short code examples, etc. If this makes sense, I can file a subtask task around adding missing pages to Cookbook.

After careful consideration and in consultation with @srishakatux, I'm declining this task. The scope of this task is very broad and the success/completion criteria unclear. I will shortly follow this up with some tasks or proposals to address the underlying issues raised here.