From d9a0ce5d7273ed9414d3d6a2127ac4b6a983523e Mon Sep 17 00:00:00 2001 From: zhanghao Date: Wed, 20 Nov 2019 03:54:29 -0500 Subject: [PATCH] Stop testing Python 2 This change removes the requirement for python 2 and removes testing for it, but tries to leave the code compatible with python2 where possible. Co-Authored-By: Nate Johnston Change-Id: I711ae939b5eaa1816af15b22527c38858507127f --- .zuul.yaml | 14 +------------- neutron_lib/utils/helpers.py | 8 +------- .../notes/drop-python-2-7-f46dfa10169f70db.yaml | 5 +++++ requirements.txt | 1 - setup.cfg | 6 +----- tox.ini | 14 ++------------ 6 files changed, 10 insertions(+), 38 deletions(-) create mode 100644 releasenotes/notes/drop-python-2-7-f46dfa10169f70db.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 774e4f19c..2d512738e 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -4,18 +4,11 @@ - publish-openstack-docs-pti - openstack-cover-jobs - openstack-lower-constraints-jobs - - openstack-python-jobs - - openstack-python3-train-jobs - - lib-forward-testing + - openstack-python3-ussuri-jobs - lib-forward-testing-python3 - release-notes-jobs-python3 check: jobs: - # This job comes from lib-forward-testing template, - # but it is limited to 2h there and we want to set - # for it 3h timeout - - tempest-full: - timeout: 10800 # This job comes from lib-forward-testing-python3 template, # but it is limited to 2h there and we want to set # for it 3h timeout @@ -23,11 +16,6 @@ timeout: 10800 gate: jobs: - # This job comes from lib-forward-testing template, - # but it is limited to 2h there and we want to set - # for it 3h timeout - - tempest-full: - timeout: 10800 # This job comes from lib-forward-testing-python3 template, # but it is limited to 2h there and we want to set # for it 3h timeout diff --git a/neutron_lib/utils/helpers.py b/neutron_lib/utils/helpers.py index 5f999c972..203172e5b 100644 --- a/neutron_lib/utils/helpers.py +++ b/neutron_lib/utils/helpers.py @@ -179,13 +179,7 @@ def safe_decode_utf8(s): return s -try: - # PY3 - weak_method = weakref.WeakMethod -except AttributeError: - # PY2 - import weakrefmethod - weak_method = weakrefmethod.WeakMethod +weak_method = weakref.WeakMethod def make_weak_ref(f): diff --git a/releasenotes/notes/drop-python-2-7-f46dfa10169f70db.yaml b/releasenotes/notes/drop-python-2-7-f46dfa10169f70db.yaml new file mode 100644 index 000000000..63f733119 --- /dev/null +++ b/releasenotes/notes/drop-python-2-7-f46dfa10169f70db.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Python 2.7 support has been dropped. The minimum version of Python now + supported by neutron-lib is Python 3.6. diff --git a/requirements.txt b/requirements.txt index f69a5c09d..318d2da02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,6 +26,5 @@ oslo.versionedobjects>=1.31.2 # Apache-2.0 osprofiler>=1.4.0 # Apache-2.0 setproctitle>=1.1.10 # BSD WebOb>=1.7.1 # MIT -weakrefmethod>=1.0.2;python_version=='2.7' # PSF os-traits>=0.9.0 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg index e09ec69c0..31a37516a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ description-file = author = OpenStack author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/neutron-lib/latest/ +python-requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -13,8 +14,6 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 @@ -42,6 +41,3 @@ input_file = neutron_lib/locale/neutron_lib.pot keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = neutron_lib/locale/neutron_lib.pot - -[wheel] -universal = 1 diff --git a/tox.ini b/tox.ini index 3f28a3bc2..fe8cdc500 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,8 @@ [tox] minversion = 2.3.2 -envlist = py27,py37,pep8 +envlist = py37,pep8 skipsdist = True +ignore_basepython_conflict = True [testenv] usedevelop = True @@ -20,14 +21,12 @@ commands = stestr run {posargs} [testenv:pep8] -basepython = python3 commands = flake8 {toxinidir}/tools/check_samples.sh {[testenv:bandit]commands} [testenv:releasenotes] -basepython = python3 deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt @@ -35,11 +34,9 @@ deps = commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [testenv:venv] -basepython = python3 commands = {posargs} [testenv:cover] -basepython = python3 setenv = {[testenv]setenv} PYTHON=coverage run --source neutron_lib --parallel-mode @@ -50,7 +47,6 @@ commands = coverage xml -o cover/coverage.xml [testenv:docs] -basepython = python3 deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt @@ -58,7 +54,6 @@ deps = commands = sphinx-build -W -b html doc/source doc/build/html [testenv:pdf-docs] -basepython = python3 envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} whitelist_externals = @@ -68,7 +63,6 @@ commands = make -C doc/build/pdf [testenv:api-ref] -basepython = python3 whitelist_externals = rm deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} @@ -79,7 +73,6 @@ commands = sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html [testenv:linkcheck] -basepython = python3 deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt @@ -92,11 +85,9 @@ commands = sphinx-build -W -b linkcheck doc/source doc/build/linkcheck [testenv:debug] -basepython = python3 commands = oslo_debug_helper -t neutron_lib/tests/unit {posargs} [testenv:api-report] -basepython = python3 commands = {toxinidir}/tools/api_report.sh @@ -123,7 +114,6 @@ import_exceptions = neutron_lib._i18n local-check-factory = neutron_lib.hacking.checks._neutron_lib_factory [testenv:lower-constraints] -basepython = python3 deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt