On Thu, Apr 1, 2021 at 3:54 PM Damian Johnson <[email protected]> wrote:
>
> Hi lovely Pywikibot folks. I'm the author of tor's python library [1]
> and recently decided to see what it's like to volunteer for this
> community instead.
>
> I have a few newcomer questions...
>
> 1. This email list and #pywikibot are remarkably quiet (~2/month as
> compared with the 'handful a week' described by the wiki [2]). Does
> pywikibot have any other communication channels (say, to request a
> bot) with more activity?

Individual wikis often have dedicated pages to request bot. For
example, English Wikipedia's is Wikipedia:Bot_requests [1]. Its linked
Wikidata item [2] lists many of the similar pages in different
Wikimedia sites. Though, many of the bot requests may be done by other
bot frameworks or even manually.

Discussion regarding development of the Pywikibot framework itself are
often in Phabricator [3].

[1] https://en.wikipedia.org/wiki/Wikipedia:Bot_requests
[2] https://www.wikidata.org/wiki/Q4582561
[3] https://phabricator.wikimedia.org/project/profile/87/

> 2. I created a bot account with a BotPassword to give our readme's
> example a whirl but Wikipedia evidently blocks bot access to its
> sandbox page?
>
>   % cat demo.py
>   import pywikibot
>   site = pywikibot.Site('en', 'wikipedia')  # The site we want to run our bot 
> on
>   page = pywikibot.Page(site, 'Wikipedia:Sandbox')
>   page.text = 'hello world'
>   page.save('pywikibot practice')  # Saves the page
>
>   % python pwb.py  demo.py
>   Traceback (most recent call last):
>     File "pwb.py", line 363, in <module>
>       if not main():
>     File "pwb.py", line 355, in main
>       run_python_file(filename,
>     File "pwb.py", line 74, in run_python_file
>       exec(compile(source, filename, 'exec', dont_inherit=True),
>     File "./demo.py", line 5, in <module>
>       page.save('pywikibot practice')  # Saves the page
>     File "/home/atagar/Desktop/pywikibot/core/pywikibot/tools/__init__.py",
> line 1452, in wrapper
>       return obj(*__args, **__kw)
>     File "/home/atagar/Desktop/pywikibot/core/pywikibot/tools/__init__.py",
> line 1452, in wrapper
>       return obj(*__args, **__kw)
>     File "/home/atagar/Desktop/pywikibot/core/pywikibot/page/__init__.py",
> line 1168, in save
>       raise pywikibot.OtherPageSaveError(
>   pywikibot.exceptions.OtherPageSaveError: Edit to page
> [[Wikipedia:Sandbox]] failed:
>   Editing restricted by {{bots}}, {{nobots}} or site's equivalent of
> {{in use}} template
>   CRITICAL: Exiting due to uncaught exception <class
> 'pywikibot.exceptions.OtherPageSaveError'>

This is the {{bots}} template [4].The purpose of the template here is
to prevent bots from applying automatic fixes while people are
experimenting with the sandbox. Since you are actually sandboxing you
want to add a force=True to override.

[4] https://en.wikipedia.org/wiki/Template:Bots
[5] 
https://github.com/wikimedia/pywikibot/blob/7ef994f09520f5bb658bd95843d2a795f87563c2/pywikibot/page/__init__.py#L1167

> Am I reading this error correctly? If so, maybe I could change our
> readme to something that works out of the box? If that would be ok,
> any tip on what it should demonstrate?
>
> 3. How do I run pywikibot's tests? I'd like to note the command on
> our development wiki [3].

To run individual tests:

  $ python -m tests.tests_tests HttpServerProblemTestCase.test_502
  [...]
  OK (skipped=1)
  $ python -m tests.tests_tests HttpServerProblemTestCase
  [...]
  OK (skipped=1)
  $ python -m tests.tests_tests
  [...]
  OK (skipped=1, expected failures=3)

To run the entire test suite:

$ python -m unittest
  family and mylang are not set.
  Defaulting to family='wikipedia' and mylang='test'.
  tests: max_retries reduced from 15 to 1
  Disabled test modules (to run: python -m unittest ...):
    l10n, tests
  Extra test modules (run after library, before scripts):
    titletranslate, noreferences
  Skipping tests (to run: python -m unittest ...):
    {'textlib': ['test_interwiki_format']}
  weblinkchecker depends on memento_client, which isn't available
  Skipping execution of auto-run scripts (set PYWIKIBOT_TEST_AUTORUN=1
to enable):
    ['category_redirect', 'checkimages', 'clean_sandbox', 'login',
'misspelling', 'revertbot', 'noreferences', 'parser_function_count',
'shell', 'unusedfiles', 'upload', 'welcome']
   44.684s ..
  [...]

To run the test suite in tox with all the environment setups,
doctests, flake8, etc:

  $ tox
  commit-message create:
/home/zhuyifei1999/mw-dev/pywikibot-core/.tox/commit-message
  commit-message installdeps: commit-message-validator
  commit-message develop-inst: /home/zhuyifei1999/mw-dev/pywikibot-core
  [...]

YiFei Zhu

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

Reply via email to