Szerkesztő:Bináris/Pywikibot dev cheatsheet

Basics
mw:Manual:Pywikibot
https://doc.wikimedia.org/pywikibot/master/ (Page)
mw:Manual:Pywikibot/Development

Install szerkesztés

Code szerkesztés

Versions szerkesztés

  • Supported Python versions and planned deprications are important.
  • Supported MediaWiki versions are less important, unless I want to directly interact with API.
  • Source of information: mw:Manual:Pywikibot/Compatibility
  • Note that Python 3.9+ cannot be used on Windows 7 or earlier.

Styleguides szerkesztés

Documentation: the underlying markup is reStructuredText but sphinx is used to create the final documentation files.

Sample doc:

   .. seealso:: :api:`Logevents`
   .. note:: logevents with `logtype='block'` only logs user blocks
      whereas `site.blocks` iterates all blocks including IP ranges.
   :param logtype: only iterate entries of this type
       (see mediawiki api documentation for available types)
   :param user: only iterate entries that match this user name
   :param page: only iterate entries affecting this page
   :type page: pywikibot.Page or str
   :param namespace: namespace(s) to retrieve logevents from
   :type namespace: int or Namespace or an iterable of them
   :raises KeyError: the namespace identifier was not resolved
   :raises TypeError: the namespace identifier has an inappropriate
       type such as bool, or an iterable with more than one namespace

Tests szerkesztés

Standing in core directory, in presence of i18n submodule (will fail without it):

  • python -m unittest discover -v -p "*_tests.py" – all, shortly
  • python -m unittest -v tests.api_tests tests.site_tests – two, detailed
  • python -m unittest -v tests.textlib_tests – one, detailed

I18n szerkesztés

Wikidata szerkesztés

Publish szerkesztés

Workflow szerkesztés

General szerkesztés

  • ? Who decides versions, editions and dates?
  • ? What makes a version stable?
  • ? How does a pach get into a version?

Coding szerkesztés

Tasks found on Phabricator
Claim → code → commit
Tasks created by myself
Does every task need a Phabricator ticket? (Obviously not.)
When do I have to previously discuss it with others?
Good first tasks for practicing
https://phabricator.wikimedia.org/maniphest/query/D.pe8.a.NRmY/#R

Commit szerkesztés

Code review szerkesztés

Phabricator tasks szerkesztés

Concepts szerkesztés

Gerrit
mw:Gerrit
Repository and code review tool
Jenkins
mw:Continuous integration/Jenkins
Runs automated tests and checks coding style.
Tox
https://tox.wiki/en/latest/
Test automatization