For those of us stuck on old MediaWiki versions, pywikibot helpfully provides a warning that new versions of pywikibot might not work with our MediaWiki version: https://github.com/wikimedia/pywikibot/blob/3d5f366a465f4e0c3115bffed919b0185ac9feb8/pywikibot/site/__init__.py#L2753-L2760. This indicates that pywikibot version 3.0.20200111 should be used. Unfortunately, pinning the pywikibot version in setup.py via
install_requires=["pywikibot==3.0.20200111"],
is not working reliably because pywikibots setup.py causes the generated version number to be different from 3.0.20200111 when installed via setup.py. Instead, the following warning is generated:
[...] creating /Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pywikibot-3.0.dev0-py3.7.egg Extracting pywikibot-3.0.dev0-py3.7.egg to /Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages pywikibot 3.0.dev0 is already the active version in easy-install.pth Installed /Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pywikibot-3.0.dev0-py3.7.egg error: The 'pywikibot==3.0.20200111' distribution was not found and is required by pwbtest
This doesn't break anything so far. However, if the same setup.py specifies entrypoints for console_scripts, those don't work, either, because they perform a version check before running user code:
Traceback (most recent call last):
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pywikibot 3.0.dev0 (/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pywikibot-3.0.dev0-py3.7.egg), Requirement.parse('pywikibot==3.0.20200111'), {'pwbtest'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/wieland/dev/pwbtest/venv/bin/pwbtestcli", line 6, in <module>
from pkg_resources import load_entry_point
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3250, in <module>
@_call_aside
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3234, in _call_aside
f(*args, **kwargs)
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3263, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/Users/wieland/dev/pwbtest/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pywikibot==3.0.20200111' distribution was not found and is required by pwbtestI have provided a repository at https://github.com/mineo/pwbtest to reproduce this problem. Run repro.sh in it (it creates a virtualenv in the repository) and follow the instructions.
Installing the same version of pywikibot via pip install pywikibot==3.0.20200111 works, though.