jayvdb added a comment.
IMO the BaseSite.__init__ shouldnt be where lang/code is auto-guessed. This should be done in the pywikibot.Site factory function, with some help from the command line arg parsing routines if required.
An approach I have been mulling over is : the default site (URL) for any family is the one which has the same code as the family name. i.e. 'wikidata:wikidata' , 'commons:commons', etc. This is only *necessary* where the family has multiple codes, but it would be good to make that rule universal, which would mean changing the code of some sites, such as the wikitech families only site would be changed from 'en'->'wikitech', and the osm family needs the same change, and lyricwiki could be changed, however there are other languages of this family which are not in the family file, so I'd suggest not touching that one.
Then -family:wikidata (i.e. on the command line) would implicitly be -lang:wikidata also. To use test.wikidata via the command line, it needs to be explicitly mentioned: i.e. -family:wikidata -lang:test .
TASK DETAIL https://phabricator.wikimedia.org/T71255
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: m4tx, jayvdb Cc: pywikipedia-bugs, Ladsgroup, jayvdb, Mpaa, Ricordisamoa, XZise, Xqt, valhallasw, m4tx