jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/445095 )
Change subject: Drop Python 2.7.2/2.7.3 support
......................................................................
Drop Python 2.7.2/2.7.3 support
Bug: T191192
Change-Id: I694c8e1a483f3637939db43a8ea2f154a05f710e
---
M .appveyor.yml
M HISTORY.rst
M dev-requirements.txt
M docs/index.rst
M pwb.py
M pywikibot/README.rst
M pywikibot/__init__.py
M pywikibot/site_detect.py
M pywikibot/textlib.py
M requirements.txt
M setup.py
M tests/__init__.py
M tests/utils.py
13 files changed, 44 insertions(+), 103 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.appveyor.yml b/.appveyor.yml
index aa5f763..315f09c 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -17,16 +17,16 @@
# Test the lowest supported release of each major Python version.
- - PYTHON: "C:\\Python272"
- PYTHON_VERSION: "2.7.2"
+ - PYTHON: "C:\\Python274"
+ PYTHON_VERSION: "2.7.4"
PYTHON_ARCH: "32"
- PYTHON: "C:\\Python341"
PYTHON_VERSION: "3.4.1"
PYTHON_ARCH: "32"
- - PYTHON: "C:\\Python272-x64"
- PYTHON_VERSION: "2.7.2"
+ - PYTHON: "C:\\Python274-x64"
+ PYTHON_VERSION: "2.7.4"
PYTHON_ARCH: "64"
- PYTHON: "C:\\Python341-x64"
diff --git a/HISTORY.rst b/HISTORY.rst
index 0033fb2..2c30039 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,7 +3,7 @@
Current release
---------------
-
+* Dropped support for py2.7.2 and py2.7.3 (T191192)
* Bugfixes and improvements
* Localisation updates
diff --git a/dev-requirements.txt b/dev-requirements.txt
index ea8424c..828eac5 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,7 +1,5 @@
# This is a PIP 6+ requirements file for development dependencies
#
-unittest2==0.8.0 ; python_full_version == '2.7.2'
-
pytest>=3.6.0
pytest-timeout
pytest-runner
diff --git a/docs/index.rst b/docs/index.rst
index 2b780e2..b471ea5 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -13,7 +13,7 @@
Pywikibot is a Python library and collection of scripts that automate work on `MediaWiki <https://mediawiki.org>`_ sites.
-Pywikibot supports Python 2.7.2+ and 3.4+.
+Pywikibot supports Python 2.7.4+ and 3.4+.
Pywikibot and this documentation are licensed under the :ref:`MIT license <licenses-MIT>`;
manual pages on mediawiki.org are licensed under the `CC-BY-SA 3.0`_ license.
diff --git a/pwb.py b/pwb.py
index 26d6d66..d6211ef 100755
--- a/pwb.py
+++ b/pwb.py
@@ -9,7 +9,7 @@
and it will use the package directory to store all user files, will fix up
search paths so the package does not need to be installed, etc.
"""
-# (C) Pywikibot team, 2012-2018
+# (C) Pywikibot team, 2012-2019
#
# Distributed under the terms of the MIT license.
#
@@ -29,14 +29,14 @@
Pywikibot is not available on:
{version}
-This version of Pywikibot only supports Python 2.7.2+ or 3.4+.
+This version of Pywikibot only supports Python 2.7.4+ or 3.4+.
"""
def python_is_supported():
"""Check that Python is supported."""
# Any change to this must be copied to setup.py
- return PYTHON_VERSION >= (3, 4, 0) or PY2 and PYTHON_VERSION >= (2, 7, 2)
+ return PYTHON_VERSION >= (3, 4, 0) or PY2 and PYTHON_VERSION >= (2, 7, 4)
if not python_is_supported():
diff --git a/pywikibot/README.rst b/pywikibot/README.rst
index a817648..7303b28 100644
--- a/pywikibot/README.rst
+++ b/pywikibot/README.rst
@@ -30,7 +30,7 @@
* python-tkinter (optional, used by some experimental GUI stuff)
-You need to have at least python version `2.7.2 <http://www.python.org/download/>`_
+You need to have at least python version `2.7.4 <http://www.python.org/download/>`_
or newer installed on your computer to be able to run any of the code in this
package, but not 3.0-3.3. It works fine with 3.4+ versions of python installed.
Support for older versions of python is not planned. Some scripts could run with
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 899710a..61b2699 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""The initialization file for the Pywikibot framework."""
#
-# (C) Pywikibot team, 2008-2018
+# (C) Pywikibot team, 2008-2019
#
# Distributed under the terms of the MIT license.
#
@@ -133,14 +133,6 @@
deprecate_arg = redirect_func(_deprecate_arg)
-if sys.version_info[:2] == (2, 7) and sys.version_info[2] in (2, 3):
- warn(
- 'Pywikibot will soon drop support for Python 2.7.2 and 2.7.3, '
- 'please update your Python.',
- FutureWarning,
- )
-
-
class Timestamp(datetime.datetime):
"""Class for handling MediaWiki timestamps.
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index c8d6f13..5bc6a74 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Classes for detecting a MediaWiki site."""
#
-# (C) Pywikibot team, 2010-2018
+# (C) Pywikibot team, 2010-2019
#
# Distributed under the terms of the MIT license.
#
@@ -23,10 +23,7 @@
from html.parser import HTMLParser
from urllib.parse import urljoin, urlparse
else:
- if PYTHON_VERSION == (2, 7, 2):
- from future.backports.html.parser import HTMLParser # T175873
- else:
- from HTMLParser import HTMLParser
+ from HTMLParser import HTMLParser
from urlparse import urljoin, urlparse
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 83cade7..500ebd0 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -7,7 +7,7 @@
"""
#
-# (C) Pywikibot team, 2008-2018
+# (C) Pywikibot team, 2008-2019
#
# Distributed under the terms of the MIT license.
#
@@ -110,44 +110,32 @@
# [[ or ]].
# The namespace names must be substituted into this regex.
# e.g. FILE_LINK_REGEX % 'File' or FILE_LINK_REGEX % '|'.join(site.namespaces)
-if sys.version_info[:3] >= (2, 7, 4):
- FILE_LINK_REGEX = r"""
- \[\[\s*
- (?:%s) # namespace aliases
- \s*:
- (?=(?P<filename>
- [^]|]*
- ))(?P=filename)
+FILE_LINK_REGEX = r"""
+ \[\[\s*
+ (?:%s) # namespace aliases
+ \s*:
+ (?=(?P<filename>
+ [^]|]*
+ ))(?P=filename)
+ (
+ \|
(
- \|
(
- (
- (?=(?P<inner_link>
- \[\[.*?\]\]
- ))(?P=inner_link)
- )?
- (?=(?P<other_chars>
- [^\[\]]*
- ))(?P=other_chars)
- |
- (?=(?P<not_wikilink>
- \[[^]]*\]
- ))(?P=not_wikilink)
- )*?
- )??
- \]\]
- """
-else:
- # Python 2.7.2 and 2.7.3 re bug (T191161)
- FILE_LINK_REGEX = r"""
- \[\[\s*(?:%s)\s*:[^|]*?\s*
- (\|
- ( ( \[\[ .*? \]\] )? [^[]*?
- | \[ [^]]*? \]
- )*
- )?
+ (?=(?P<inner_link>
+ \[\[.*?\]\]
+ ))(?P=inner_link)
+ )?
+ (?=(?P<other_chars>
+ [^\[\]]*
+ ))(?P=other_chars)
+ |
+ (?=(?P<not_wikilink>
+ \[[^]]*\]
+ ))(?P=not_wikilink)
+ )*?
+ )??
\]\]
- """
+"""
NON_LATIN_DIGITS = {
'ckb': '٠١٢٣٤٥٦٧٨٩',
diff --git a/requirements.txt b/requirements.txt
index 551d858..36d9ba7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -24,8 +24,6 @@
# requests security extra
requests[security] ; python_full_version > '2.7.6' and python_full_version < '2.7.9'
-future>=0.15.0 ; python_full_version < '2.7.3'
-
ipaddr>=2.1.10 ; python_version < '3'
# OAuth support
diff --git a/setup.py b/setup.py
index a73a804..00745d1 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Installer script for Pywikibot 3.0 framework."""
#
-# (C) Pywikibot team, 2009-2018
+# (C) Pywikibot team, 2009-2019
#
# Distributed under the terms of the MIT license.
#
@@ -13,17 +13,6 @@
from setuptools import find_packages, setup
-if sys.version_info[:3] < (2, 7, 4):
- try:
- # Work around a traceback on Python < 2.7.4
- # http://bugs.python.org/issue15881#msg170215
- import multiprocessing
- except ImportError:
- pass
- else:
- _unused = multiprocessing # pyflakes workaround
-
-
PYTHON_VERSION = sys.version_info[:3]
PY2 = (PYTHON_VERSION[0] == 2)
@@ -31,14 +20,14 @@
Pywikibot is not available on:
{version}
-This version of Pywikibot only supports Python 2.7.2+ or 3.4+.
+This version of Pywikibot only supports Python 2.7.4+ or 3.4+.
"""
def python_is_supported():
"""Check that Python is supported."""
# Any change to this must be copied to pwb.py
- return PYTHON_VERSION >= (3, 4, 0) or PY2 and PYTHON_VERSION >= (2, 7, 2)
+ return PYTHON_VERSION >= (3, 4, 0) or PY2 and PYTHON_VERSION >= (2, 7, 4)
if not python_is_supported():
@@ -110,15 +99,6 @@
'git+https://github.com/vasily-v-ryabov/pywinauto-64#egg=pywinauto',
]
-if PYTHON_VERSION == (2, 7, 2):
- # work around distutils hardcoded unittest dependency
- # work around T106512
- import unittest
- _unused = unittest
- if 'test' in sys.argv:
- import unittest2
- sys.modules['unittest'] = unittest2
-
if PY2:
# tools.ip does not have a hard dependency on an IP address module,
# as it falls back to using regexes if one is not available.
@@ -130,9 +110,6 @@
# ipaddr 2.1.10+ is distributed with Debian and Fedora. See T105443.
dependencies.append('ipaddr>=2.1.10')
- if PYTHON_VERSION == (2, 7, 2):
- dependencies.append('future>=0.15.0') # Bug fixes for HTMLParser
-
if (2, 7, 6) < PYTHON_VERSION < (2, 7, 9):
# Python versions before 2.7.9 will cause urllib3 to trigger
# InsecurePlatformWarning warnings for all HTTPS requests. By
@@ -240,7 +217,7 @@
packages=[str(name)] + [package
for package in find_packages()
if package.startswith('pywikibot.')],
- python_requires='>=2.7.2, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
+ python_requires='>=2.7.4, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
install_requires=dependencies,
dependency_links=dependency_links,
extras_require=extra_deps,
diff --git a/tests/__init__.py b/tests/__init__.py
index 7bddc15..7f47850 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Package tests."""
#
-# (C) Pywikibot team, 2007-2018
+# (C) Pywikibot team, 2007-2019
#
# Distributed under the terms of the MIT license.
#
@@ -19,9 +19,9 @@
# Verify that the unit tests have a base working environment:
# - requests is mandatory
# however if unavailable this will fail on use; see pywikibot/tools.py
-# - unittest2; see below
# - mwparserfromhell is optional, so is only imported in textlib_tests
import requests
+import unittest
from pywikibot import config
import pywikibot.data.api
@@ -30,11 +30,6 @@
from pywikibot import i18n
from pywikibot.tools import PYTHON_VERSION
-if PYTHON_VERSION == (2, 7, 2):
- # Use unittest2 for python 2.7.2 (T106512)
- import unittest2 as unittest
-else:
- import unittest
try:
import unittest.mock as mock
from unittest.mock import MagicMock, Mock, patch
diff --git a/tests/utils.py b/tests/utils.py
index c0ce35b..09d423f 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Test utilities."""
#
-# (C) Pywikibot team, 2013-2018
+# (C) Pywikibot team, 2013-2019
#
# Distributed under the terms of the MIT license.
#
@@ -643,10 +643,6 @@
@param command: executable to run and arguments to use
@type command: list of unicode
"""
- if PYTHON_VERSION[:2] == (2, 7) and PYTHON_VERSION[2] in (2, 3):
- command.insert(1, '-W ignore:{0}:DeprecationWarning'.format(
- 'Pywikibot will soon drop support for Python 2.7.2 and 2.7.3, '
- 'please update your Python.'))
if cryptography_version and cryptography_version < [1, 3, 4]:
command.insert(1, '-W ignore:Old version of cryptography:Warning')
# Any environment variables added on Windows must be of type
--
To view, visit https://gerrit.wikimedia.org/r/445095
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I694c8e1a483f3637939db43a8ea2f154a05f710e
Gerrit-Change-Number: 445095
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 (4879)
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/487474 )
Change subject: [tests] Cleanup flake8 settings at tox.ini
......................................................................
[tests] Cleanup flake8 settings at tox.ini
Change-Id: Idb20ef489b1547089c6a79f6ab3b80c9fb289df8
---
M tox.ini
1 file changed, 10 insertions(+), 10 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tox.ini b/tox.ini
index f830fd6..f73319a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -118,24 +118,16 @@
# H301: Do not import more than one module per line; Pywikibot uses H306 (Alphabetically order your imports by the full module path)
# H404: docstring multiline start
# H405: docstring summary line
+# H903: Use only UNIX style newlines, not Windows style
# P101: format string does contain unindexed parameters
# P102: docstring does contain unindexed parameters
# P103: other string does contain unindexed parameters
# W503: line break before binary operator; against current PEP 8 recommendation
-# The following are to be fixed
-# D102: Missing docstring in public method
-# D103: Missing docstring in public function
-# N802: function name should be lowercase
-# N803: argument name should be lowercase
-# N806: variable in function should be lowercase
-# N815: mixedCase variable in class scope
-# N816: mixedCase variable in global scope
-
# Errors occured after upgrade to pydocstyle 2.0.0 (T164142)
# D401: First line should be in imperative mood; try rephrasing
-# D413: Missing blank line after last section
# D412: No blank lines allowed between a section header and its content
+# D413: Missing blank line after last section
ignore = D105,D211,D401,D413,D412,FI12,FI13,FI15,FI16,FI17,FI5,H101,H236,H301,H404,H405,H903,P101,P102,P103,W503
enable-extensions = H203,H204,H205
@@ -144,6 +136,14 @@
accept-encodings = utf-8
require-code = true
classmethod-decorators = classmethod,classproperty
+
+# The following are to be fixed
+# N802: function name should be lowercase
+# N803: argument name should be lowercase
+# N806: variable in function should be lowercase
+# N815: mixedCase variable in class scope
+# N816: mixedCase variable in global scope
+
per-file-ignores =
generate_family_file.py : T001
pwb.py : T001
--
To view, visit https://gerrit.wikimedia.org/r/487474
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Idb20ef489b1547089c6a79f6ab3b80c9fb289df8
Gerrit-Change-Number: 487474
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/486715 )
Change subject: Re-added the warning() documentation
......................................................................
Re-added the warning() documentation
Bug: T85271
Change-Id: I6dfef5a125a409e5e88238071e4dbca7c5f06847
---
M pywikibot/logging.py
1 file changed, 13 insertions(+), 2 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index fd64b76..4cf2691 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Logging functions."""
#
-# (C) Pywikibot team, 2010-2018
+# (C) Pywikibot team, 2010-2019
#
# Distributed under the terms of the MIT license.
#
@@ -149,7 +149,18 @@
def warning(text, decoder=None, newline=True, **kwargs):
- """Output a warning message to the user via the userinterface."""
+ """Output a warning message to the user via the userinterface.
+
+ @param text: the message the user wants to display.
+ @type text: str
+ @param decoder: If None, text should be a unicode string. Otherwise it
+ should be encoded in the given encoding.
+ @type decoder: str
+ @param newline: If True, a line feed will be added after printing the text.
+ @type newline: bool
+ @param kwargs: The keyword arguments can be found in the python doc:
+ https://docs.python.org/2/howto/logging-cookbook.html#logging-cookbook.
+ """
logoutput(text, decoder, newline, WARNING, **kwargs)
--
To view, visit https://gerrit.wikimedia.org/r/486715
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6dfef5a125a409e5e88238071e4dbca7c5f06847
Gerrit-Change-Number: 486715
Gerrit-PatchSet: 5
Gerrit-Owner: Kaushik Reddy <reddykaushik18(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-CC: Xqt <info(a)gno.de>