jayvdb added a comment.

The current patch works on Py2.6+, and achieves my main objective of a) not 
automatically loading the overlaid subpackages or family classes, and b) the 
family modules are real modules in sys.modules.  It also achieves a less 
important goal of having a single namespace for all family modules, and that 
namespace can be extended further by updating the package __path__.

As a result, there is very little performance lost in splitting the family 
classes into lots of family packages, and having family classes for lots of 
wikis.
Family.load does iterate over all family modules to determine the list of valid 
Family names (and which subpackage it is found in), which is a performance hit, 
however that can easily be changed so that it attempts to loads the family by 
name, so that family modules at the top level (or in subpackage if/when we 
permit '.' in the name) and catches the import error to indicate it needs to 
scan all family packages.

Another way to avoid scanning all family package is for each family subpackage 
to include a directory of family modules/classes it contains.  This directory 
could also help speed up our from_url algorithm, as the wildcarded domains 
could also be included, so from_url could skip loading all modules when the 
subpackage domain list indicates the modules therein wont help resolve the URL. 
 This will be especially helpful for large wiki farms which put each wiki on a 
subdomain, as one wildcard entry would be sufficient to exclude all of the 
families in that wikifarm. (e.g. the majority of Wikia wikis).


TASK DETAIL
  https://phabricator.wikimedia.org/T104130

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: jayvdb
Cc: gerritbot, pywikibot-bugs-list, jayvdb, Gallaecio, Aklapper, XZise, 
Malyacko, P.Copp



_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to