A list of acceptable characters for the name attribute of a family class was added in e6e1e17f. We've had requests for _ and . to be added to the list. I have no objections to sensible additions, but would prefer that we move towards the filename and class name and class attribute name all being aligned.
|Open||None||T103810 Allow additional characters in family class name|
|Open||None||T104130 Family packages|
|Declined||Mahveotm||T60878 Report sensible error when family file cannot be loaded|
The class name are current required to be Family I think, but I would like to break that requirement and allow the class name to be WikipediaFamily with a name attribute of wikipedia.
@Gallaecio, would it help if we added subdirectory/subpackage support, so you could have your own package pywikibot.families.foo which contains a set of family files (and that package could be managed on pypi even)?
I was talking about the codename, the one that you pass to the -family parameter. To refer to our wikis, before I even started using PyWikiBot, we had codes such as "xe8.lib" to refer to certain wikis. When I started using PyWikiBot, I decided to stick to those names, and since it was possible, I did so. But I could use "xe8lib" instead.
My main concern is separation between the families of the wikis of my company and the public families of PyWikiBot. Specially because, although unlikely, name collision would be possible. And, given a name collision, I would like my custom family files to take precedence over those of PyWikiBot. As long as that is possible, a subpackage within the families folder would certainly be an option.
Later today I will review the actual implementation that I have for family files (I generate them by script from some INI files that we have, so I’m not familiar with the actual implementation), to see if there is anything else that may be a problem. But I do not mind making changes on my end as needed.
My patch (https://gerrit.wikimedia.org/r/#/c/220409/) allows custom family to take precedence, as register_families_folder('custom_folder') will replace existing ones registered earlier from register_families_folder('pywikibot/families').
On two related changes (https://gerrit.wikimedia.org/r/#/c/221119 and https://gerrit.wikimedia.org/r/#/c/221116) we're discussing, among other things, whether it will be useful to have multiple classes in a single module. I suspect this will be simpler for some families. e.g. with https://gerrit.wikimedia.org/r/#/c/219617/, the Wikimedia meta-family becomes much less complicated, and after that patch is another patch (not yet submitted) that defines the interwiki_forward rule in one place, which causes most of the Wikimedia families to become only two attributes: name and domain.