Skip to content

Commit 820fda6

Browse files
committed
breaking: drop Python 2 support
1 parent 019c2be commit 820fda6

7 files changed

+6
-35
lines changed

README.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Supported Python Versions
9393

9494
SageMaker Python SDK is tested on:
9595

96-
- Python 2.7
9796
- Python 3.6
9897
- Python 3.7
9998

@@ -121,10 +120,9 @@ You can install the libraries needed to run the tests by running :code:`pip inst
121120

122121
**Unit tests**
123122

124-
125123
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
126-
code fits our style guidelines. We run tox with Python 2.7, 3.6 and 3.7, so to run unit tests
127-
with the same configuration we do, you'll need to have interpreters for Python 2.7, Python 3.6 and Python 3.7 installed.
124+
code fits our style guidelines. We run tox with `all of our supported Python versions <#supported-python-versions>`_, so to run unit tests
125+
with the same configuration we do, you need to have interpreters for those Python versions installed.
128126

129127
To run the unit tests with tox, run:
130128

buildspec-localmodetests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ phases:
1111

1212
# local mode tests
1313
- start_time=`date +%s`
14-
- 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"
15-
- ./ci-scripts/displaytime.sh 'py27,py37 local mode' $start_time
14+
- 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"
15+
- ./ci-scripts/displaytime.sh 'py37 local mode' $start_time

buildspec-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ phases:
1818
# run unit tests
1919
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
2020
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=
21-
tox -e py27,py36,py37 -- tests/unit
21+
tox -e py36,py37 -- tests/unit
2222

2323
# run a subset of the integration tests
2424
- IGNORE_COVERAGE=- tox -e py36 -- tests/integ -m canary_quick -n 64 --boxed --reruns 2

buildspec-unittests.yml

-7
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,3 @@ phases:
2020
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=
2121
tox -e py36,py37 --parallel all -- tests/unit
2222
- ./ci-scripts/displaytime.sh 'py36,py37 unit' $start_time
23-
24-
# Remove once https://github.com/aws/sagemaker-python-sdk/issues/1461 is addressed.
25-
- start_time=`date +%s`
26-
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
27-
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=
28-
IGNORE_COVERAGE=- tox -e py27 --parallel all -- tests/unit
29-
- ./ci-scripts/displaytime.sh 'py27 unit' $start_time

setup.py

-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import os
1717
from glob import glob
18-
import sys
1918

2019
from setuptools import setup, find_packages
2120

@@ -77,10 +76,6 @@ def read_version():
7776
],
7877
)
7978

80-
# enum is introduced in Python 3.4. Installing enum back port
81-
if sys.version_info < (3, 4):
82-
required_packages.append("enum34>=1.1.6")
83-
8479
setup(
8580
name="sagemaker",
8681
version=read_version(),
@@ -99,7 +94,6 @@ def read_version():
9994
"Natural Language :: English",
10095
"License :: OSI Approved :: Apache Software License",
10196
"Programming Language :: Python",
102-
"Programming Language :: Python :: 2.7",
10397
"Programming Language :: Python :: 3.6",
10498
"Programming Language :: Python :: 3.7",
10599
],

src/sagemaker/__init__.py

-9
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
"""Placeholder docstring"""
1414
from __future__ import absolute_import
1515

16-
import logging
17-
import sys
1816
import importlib_metadata
1917

2018
from sagemaker import estimator, parameter, tuner # noqa: F401
@@ -63,10 +61,3 @@
6361
from sagemaker.automl.candidate_estimator import CandidateEstimator, CandidateStep # noqa: F401
6462

6563
__version__ = importlib_metadata.version("sagemaker")
66-
67-
if sys.version[0] == "2":
68-
logging.getLogger("sagemaker").warning(
69-
"SageMaker Python SDK v2 will no longer support Python 2. "
70-
"Please see https://github.com/aws/sagemaker-python-sdk/issues/1459 "
71-
"for more information"
72-
)

tox.ini

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = black-format,flake8,pylint,twine,sphinx,doc8,py27,py36,py37,py38
7+
envlist = black-format,flake8,pylint,twine,sphinx,doc8,py36,py37,py38
88

99
skip_missing_interpreters = False
1010

@@ -19,7 +19,6 @@ exclude =
1919
.tox
2020
tests/data/
2121
venv/
22-
*service_pb2_grpc.py
2322

2423
max-complexity = 10
2524

@@ -66,10 +65,6 @@ commands =
6665
{env:IGNORE_COVERAGE:} coverage report --fail-under=86
6766
extras = test
6867

69-
[testenv:py27]
70-
setenv =
71-
IGNORE_COVERAGE = -
72-
7368
[testenv:flake8]
7469
basepython = python3
7570
skipdist = true

0 commit comments

Comments
 (0)