From 820fda6ad4633ccf65791b6c917ac173a07d9cb3 Mon Sep 17 00:00:00 2001 From: Lauren Yu <6631887+laurenyu@users.noreply.github.com> Date: Tue, 9 Jun 2020 16:55:34 -0700 Subject: [PATCH] breaking: drop Python 2 support --- README.rst | 6 ++---- buildspec-localmodetests.yml | 4 ++-- buildspec-release.yml | 2 +- buildspec-unittests.yml | 7 ------- setup.py | 6 ------ src/sagemaker/__init__.py | 9 --------- tox.ini | 7 +------ 7 files changed, 6 insertions(+), 35 deletions(-) diff --git a/README.rst b/README.rst index eb079037ab..ab9d52b8f4 100644 --- a/README.rst +++ b/README.rst @@ -93,7 +93,6 @@ Supported Python Versions SageMaker Python SDK is tested on: -- Python 2.7 - Python 3.6 - Python 3.7 @@ -121,10 +120,9 @@ You can install the libraries needed to run the tests by running :code:`pip inst **Unit tests** - We run unit tests with tox, which is a program that lets you run unit tests for multiple Python versions, and also make sure the -code fits our style guidelines. We run tox with Python 2.7, 3.6 and 3.7, so to run unit tests -with the same configuration we do, you'll need to have interpreters for Python 2.7, Python 3.6 and Python 3.7 installed. +code fits our style guidelines. We run tox with `all of our supported Python versions <#supported-python-versions>`_, so to run unit tests +with the same configuration we do, you need to have interpreters for those Python versions installed. To run the unit tests with tox, run: diff --git a/buildspec-localmodetests.yml b/buildspec-localmodetests.yml index 3e82906546..2c5c403141 100644 --- a/buildspec-localmodetests.yml +++ b/buildspec-localmodetests.yml @@ -11,5 +11,5 @@ phases: # local mode tests - start_time=`date +%s` - - execute-command-if-has-matching-changes "tox -e py27,py37 -- tests/integ -m local_mode --durations 50" "tests/integ" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "setup.py" "setup.cfg" "buildspec-localmodetests.yml" - - ./ci-scripts/displaytime.sh 'py27,py37 local mode' $start_time + - execute-command-if-has-matching-changes "tox -e py37 -- tests/integ -m local_mode --durations 50" "tests/integ" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "setup.py" "setup.cfg" "buildspec-localmodetests.yml" + - ./ci-scripts/displaytime.sh 'py37 local mode' $start_time diff --git a/buildspec-release.yml b/buildspec-release.yml index 31814ced39..1b6cbc30c9 100644 --- a/buildspec-release.yml +++ b/buildspec-release.yml @@ -18,7 +18,7 @@ phases: # run unit tests - AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN= AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION= - tox -e py27,py36,py37 -- tests/unit + tox -e py36,py37 -- tests/unit # run a subset of the integration tests - IGNORE_COVERAGE=- tox -e py36 -- tests/integ -m canary_quick -n 64 --boxed --reruns 2 diff --git a/buildspec-unittests.yml b/buildspec-unittests.yml index 2a61440344..aa9d844bd9 100644 --- a/buildspec-unittests.yml +++ b/buildspec-unittests.yml @@ -20,10 +20,3 @@ phases: AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION= tox -e py36,py37 --parallel all -- tests/unit - ./ci-scripts/displaytime.sh 'py36,py37 unit' $start_time - - # Remove once https://github.com/aws/sagemaker-python-sdk/issues/1461 is addressed. - - start_time=`date +%s` - - AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN= - AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION= - IGNORE_COVERAGE=- tox -e py27 --parallel all -- tests/unit - - ./ci-scripts/displaytime.sh 'py27 unit' $start_time diff --git a/setup.py b/setup.py index 51bb640789..7cbc1f4735 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,6 @@ import os from glob import glob -import sys from setuptools import setup, find_packages @@ -77,10 +76,6 @@ def read_version(): ], ) -# enum is introduced in Python 3.4. Installing enum back port -if sys.version_info < (3, 4): - required_packages.append("enum34>=1.1.6") - setup( name="sagemaker", version=read_version(), @@ -99,7 +94,6 @@ def read_version(): "Natural Language :: English", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", ], diff --git a/src/sagemaker/__init__.py b/src/sagemaker/__init__.py index 122e10e927..6b35f5abb9 100644 --- a/src/sagemaker/__init__.py +++ b/src/sagemaker/__init__.py @@ -13,8 +13,6 @@ """Placeholder docstring""" from __future__ import absolute_import -import logging -import sys import importlib_metadata from sagemaker import estimator, parameter, tuner # noqa: F401 @@ -63,10 +61,3 @@ from sagemaker.automl.candidate_estimator import CandidateEstimator, CandidateStep # noqa: F401 __version__ = importlib_metadata.version("sagemaker") - -if sys.version[0] == "2": - logging.getLogger("sagemaker").warning( - "SageMaker Python SDK v2 will no longer support Python 2. " - "Please see https://github.com/aws/sagemaker-python-sdk/issues/1459 " - "for more information" - ) diff --git a/tox.ini b/tox.ini index 006ec1532c..d14ffc75c9 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = black-format,flake8,pylint,twine,sphinx,doc8,py27,py36,py37,py38 +envlist = black-format,flake8,pylint,twine,sphinx,doc8,py36,py37,py38 skip_missing_interpreters = False @@ -19,7 +19,6 @@ exclude = .tox tests/data/ venv/ - *service_pb2_grpc.py max-complexity = 10 @@ -66,10 +65,6 @@ commands = {env:IGNORE_COVERAGE:} coverage report --fail-under=86 extras = test -[testenv:py27] -setenv = - IGNORE_COVERAGE = - - [testenv:flake8] basepython = python3 skipdist = true