What about the suggestion to add derived class WikipediaPage (and module _wikipdia_page) I don't see any problem with this solution. We have the _wikibase module and all its class are imported to the main module __init__. I don't think it's a problem to open another specific module.

And I say that as a person who use pywikibot not for Wikipedia (but Wikisource). Although I agree that it's can't be a method on the main 'Page' class.


בתאריך יום ו׳, 31 במרץ 2023, 17:07, מאת Bináris ‏<wikiposta@gmail.com>:
Tl;dr: is there a place for Wikipedia-related code? What do we do for code reusability?

I proposed a Page method in https://phabricator.wikimedia.org/T328769.
This would have shown if an article is a biography (it is about a person).
My idea was opposed because the codebase of BasePage and APIPage is not Wikipedia-related, and some developers don't want to see any Wikipedia-specific code in it.
OK, let's say, this is a valid argument. Let's call it code purity.

On the other hand, Pywikibot is mostly developed by Wikipedians, mostly used in Wikipedia, and biographies form a primary scope of Wikipedia. I definitely think that biographies SHOULD be subclassed to have a lot of methods that are useful for a lot of Wikipedias and bot owners. If they write this code for themselves again and again, that's a waste.
Now I definitely will use this feature. What can I do?
First idea is to subclass Page in my code. That is the natural solution. Of course, when I publish my scripts, others won't be able to use them, and I won't be able to use others' scripts as they are, because I need this subclass. Let's call this point od view code reusability which is generally kept an important thing in the world of programming.

Now, what we do (see the above task) is that we throw away code reusability for the sake of code purity. Is that OK?

I am honestly curious, where the place of Wikipedia is in this framework.

What I WILL do in the present situation: write a module called huwiki and don't bother other Wikipedias and place my code into this module. It will contain functions that take the page as parameter (not nice, not natural, I don't like it, but this is the only way if I cannot subclass) and nice pagegenerators, all for Hungarian Wikipedia alone, because I need them.

Is that really what we want?
Please help to find the place of Wikipedia-related code.
--
Bináris
_______________________________________________
pywikibot mailing list -- pywikibot@lists.wikimedia.org
Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/message/FV5PQBIFQD3MFJTVOTGQJOLZC4AHZNNK/
To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org