Skip to content

breaking: drop Python 2 support #1609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ Supported Python Versions

SageMaker Python SDK is tested on:

- Python 2.7
- Python 3.6
- Python 3.7

Expand Down Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions buildspec-localmodetests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion buildspec-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions buildspec-unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 0 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import os
from glob import glob
import sys

from setuptools import setup, find_packages

Expand Down Expand Up @@ -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(),
Expand All @@ -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",
],
Expand Down
9 changes: 0 additions & 9 deletions src/sagemaker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
7 changes: 1 addition & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -19,7 +19,6 @@ exclude =
.tox
tests/data/
venv/
*service_pb2_grpc.py

max-complexity = 10

Expand Down Expand Up @@ -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
Expand Down