Hi xqt,
thank you very much for your work!
- Short creation of a site like pywikibot('commons') or pywikibot('meta') [5]
I really like this and directly tested it out (see code snippet in the end). Now I can also read the user name or the mediawiki URLs dynamically from my own config and easily change it, e.g. because I want to have a flag to either have pywikibot write to my live site or to my test environment test.myownfamily.example
I'm happy about not needing to have a families/myownfamily_family.py file anymore. Also I can do without a user-config.py apparently now. This is great because it was always an extra hindrance for other contributors to my project that they first needed to set up user-config.py and the family file and make sure they're in the right place. In my case I also have different scripts I want to run with different user names which was tricky and only possible through putting them in different folders. Now I can just read from my configuration that I anyway have and don't have the double work of maintaing the pywikibot configuration as well. And contributors just need to do a pip install pywikibot as with any other python library :)
Question: How could I set other configuration options without a user-config.py? Specifically I want to change put_throttle.
And it seems to me that using pywikibot as a site-package isn't documented very well. I'm wondering if my use case is different than that of most other pywikibot users. I have a bigger project where interacting with mediawiki via pywikibot is just one part. Going via pwb.py (as I did in the beginning) is cumbersome and other contributors are used to do a pip install and be ready to go. So most other pywikibot users just have pywikibot scripts and don't see that as a problem I guess?
That said I can imagine to help with documentation to explain the usage of pywikibot as a site-package better. I'd just need some confirmation that pywikibot is indeed intended to be used like this and a little guidance on how to get started helping with documentation.
Greetings, Samuel
Code snippet:
class MyOwnFamily(pywikibot.family.Family): # Have the same code here that was in families/myownfamily_family.py name = 'myownfamily' langs = {'en': 'www.myownfamily.example'}
def scriptpath(self, code): return '/mediawiki'
def protocol(self, code): return 'https'
family = MyOwnFamily() self.site: pywikibot.site.APISite = pywikibot.Site(code='en', fam=family, user="BotUserName")