Skip to content

Commit

Permalink
Merge "[IMPR] Show a warning if Pywikibot is running with Python 3.6"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Sep 29, 2023
2 parents 442497d + e42fae8 commit ad4ac3e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -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`)
Expand All @@ -19,6 +22,7 @@ Current release
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
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ whether you have Python installed and to find its version, just type
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.
Expand Down
12 changes: 11 additions & 1 deletion pywikibot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__',
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -470,6 +472,9 @@ def execute(command: List[str], data_in=None, timeout=None):
: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'
Expand Down

0 comments on commit ad4ac3e

Please sign in to comment.