jenkins-bot submitted this change.

View Change


Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] Show a warning if Pywikibot is running with Python 3.6

Also add an admonition item to documentation and a desupport warning
to ROADMAP.rst

Bug: T347139
Change-Id: Ifa78b3d632d27d39ffc9eeafb3ae5fec21fc6eec
---
M pywikibot/__init__.py
M ROADMAP.rst
M docs/index.rst
M tests/utils.py
4 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/ROADMAP.rst b/ROADMAP.rst
index 9814645..b7b3650 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,9 @@
Current release
---------------

+* Python 3.6 support will be discontinued and probably this is the last version supporting it
+* Upcast to :class:`pywikibot.FilePage` for a proper extension only (:phab:`T346889`)
+* Handle missing SDC mediainfo (:phab:`T345038`)
* *modules_only_mode* parameter of :class:`data.api.ParamInfo`, its *paraminfo_keys* class attribute
and its *preloaded_modules* property was deprecated, the :meth:`data.api.ParamInfo.normalize_paraminfo`
method became a staticmethod (:phab:`T306637`)
@@ -19,6 +22,7 @@
Deprecations
------------

+* 8.4.0: Python 3.6 support is deprecated and will be dropped with Pywikibot 9
* 8.4.0: *modules_only_mode* parameter of :class:`data.api.ParamInfo`, its *paraminfo_keys* class attribute
and its preloaded_modules property will be removed
* 8.4.0: *dropdelay* and *releasepid* attributes of :class:`throttle.Throttle` will be removed
diff --git a/docs/index.rst b/docs/index.rst
index 828c52a..f81d4a8 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -24,6 +24,9 @@
Python 3.6.1 or higher is currently required to run the bot, but Python 3.7
or higher is recommended. Python 3.6 support will be dropped with Pywikibot 9.

+.. attention:: Due to a security vulnerability it is strictly recommended to
+ use Python 3.7 or higher. Python 3.6 support will be dropped soon.
+
Pywikibot and this documentation are licensed under the
:ref:`MIT license`;
manual pages on mediawiki.org are licensed under the `CC-BY-SA 3.0`_ license.
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 3e14eb0..b2e7ad8 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -74,7 +74,7 @@
)
from pywikibot.site import APISite, BaseSite
from pywikibot.time import Timestamp
-from pywikibot.tools import normalize_username
+from pywikibot.tools import PYTHON_VERSION, normalize_username

__all__ = (
'__copyright__', '__description__', '__download_url__', '__license__',
@@ -99,6 +99,16 @@

_sites: Dict[str, APISite] = {}

+if PYTHON_VERSION < (3, 7):
+ warn("""
+
+ Python {version} will be dropped soon with Pywikibot 9.0
+ due to vulnerability security alerts.
+ It is recommended to use Python 3.7 or above.
+ See T347026 for further information.
+""".format(version=sys.version.split(maxsplit=1)[0]),
+ FutureWarning) # adjust this line no in utils.execute()
+

@cache
def _code_fam_from_url(url: str, name: Optional[str] = None
diff --git a/tests/utils.py b/tests/utils.py
index 5f93270..6d76c97 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -21,6 +21,8 @@
from pywikibot.exceptions import APIError
from pywikibot.login import LoginStatus
from pywikibot.site import Namespace
+from pywikibot.tools import PYTHON_VERSION
+
from tests import _pwb_py


@@ -470,6 +472,9 @@

:param command: executable to run and arguments to use
"""
+ if PYTHON_VERSION < (3, 7):
+ command.insert(1, '-W ignore::FutureWarning:pywikibot:110')
+
env = os.environ.copy()

# Prevent output by test package; e.g. 'max_retries reduced from x to y'

To view, visit change 960007. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ifa78b3d632d27d39ffc9eeafb3ae5fec21fc6eec
Gerrit-Change-Number: 960007
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged