jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1195398?usp=email )

Change subject: Announcement:Show a warning if Pywikibot is running with Python 
3.8
......................................................................

Announcement:Show a warning if Pywikibot is running with Python 3.8

Bug: T401802
Change-Id: I0edb2ded34360fa2739eb0c93bae393e1e2d6719
---
M ROADMAP.rst
M docs/index.rst
M pywikibot/__init__.py
M tests/utils.py
4 files changed, 18 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/ROADMAP.rst b/ROADMAP.rst
index be4cfa4..e1a8b9e 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,7 @@
 Current Release Changes
 =======================

+* Python 3.8 support will be discontinued and probably this is the last 
version supporting it.
 * :meth:`Family.interwiki_replacements<family.Family.interwiki_replacements>` 
is deprecated;
   use :attr:`Family.code_aliases<family.Family.code_aliases>` instead.
 * The first parameter of :meth:`Transliterator.transliterate
@@ -31,6 +32,7 @@
 Pending removal in Pywikibot 11
 -------------------------------

+* 10.6.0: Python 3.8 support is deprecated and will be dropped soon
 * 8.4.0: :attr:`data.api.QueryGenerator.continuekey` will be removed in favour 
of
   :attr:`data.api.QueryGenerator.modules`
 * 8.4.0: The *modules_only_mode* parameter in the :class:`data.api.ParamInfo` 
class, its
diff --git a/docs/index.rst b/docs/index.rst
index 46b4fe6..1673cd2 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -21,7 +21,8 @@
 whether you have Python installed and to find its version, just type
 ``python`` at the CMD or shell prompt.

-Python 3.8 or higher is currently required to run.
+Python 3.8 or higher is currently required to run the bot but Python 3.9 or
+higher is recommended. Python 3.8 support will be dropped with Pywikibot 11 
soon.

 Pywikibot and this documentation are licensed under the
 :ref:`MIT license`;
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 9b35fde..4ddaf22 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -59,7 +59,7 @@
 )
 from pywikibot.site import BaseSite as _BaseSite
 from pywikibot.time import Timestamp
-from pywikibot.tools import normalize_username
+from pywikibot.tools import PYTHON_VERSION, normalize_username

 
 if TYPE_CHECKING:
@@ -87,6 +87,15 @@

 _sites: dict[str, APISite] = {}

+if PYTHON_VERSION < (3, 9):
+    __version = sys.version.split(maxsplit=1)[0]
+    warnings.warn(f"""
+
+    Python {__version} will be dropped soon with Pywikibot 11.
+    It is recommended to use Python 3.9 or above.
+    See phab: T401802 for further information.
+""", FutureWarning)  # adjust warnings.warn line no in utils.execute()
+

 @cache
 def _code_fam_from_url(url: str, name: str | None = None) -> tuple[str, str]:
diff --git a/tests/utils.py b/tests/utils.py
index cf5860f..870ca14 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -25,6 +25,7 @@
 from pywikibot.exceptions import APIError
 from pywikibot.login import LoginStatus
 from pywikibot.site import Namespace
+from pywikibot.tools import PYTHON_VERSION
 from pywikibot.tools.collections import EMPTY_DEFAULT
 from tests import _pwb_py

@@ -474,6 +475,9 @@

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

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

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1195398?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I0edb2ded34360fa2739eb0c93bae393e1e2d6719
Gerrit-Change-Number: 1195398
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to