Skip to content

Commit 979be11

Browse files
authored
infra: support Python 3.7 (#1455)
* infra: support Python 3.7
1 parent 53fe1dc commit 979be11

8 files changed

+20
-15
lines changed

README.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ SageMaker Python SDK is tested on:
9090

9191
- Python 2.7
9292
- Python 3.6
93+
- Python 3.7
9394

9495
AWS Permissions
9596
~~~~~~~~~~~~~~~
@@ -117,8 +118,8 @@ You can install the libraries needed to run the tests by running :code:`pip inst
117118

118119

119120
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
120-
code fits our style guidelines. We run tox with Python 2.7 and 3.6, so to run unit tests
121-
with the same configuration we do, you'll need to have interpreters for Python 2.7 and Python 3.6 installed.
121+
code fits our style guidelines. We run tox with Python 2.7, 3.6 and 3.7, so to run unit tests
122+
with the same configuration we do, you'll need to have interpreters for Python 2.7, Python 3.6 and Python 3.7 installed.
122123

123124
To run the unit tests with tox, run:
124125

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,py36 -- 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,py36 local mode' $start_time
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

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 -- tests/unit
21+
tox -e py27,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

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ phases:
1818
- start_time=`date +%s`
1919
- AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_SESSION_TOKEN=
2020
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI= AWS_DEFAULT_REGION=
21-
tox -e py36,py27 --parallel all -- tests/unit
22-
- ./ci-scripts/displaytime.sh 'py36,py27 unit' $start_time
21+
tox -e py27,py36,py37 --parallel all -- tests/unit
22+
- ./ci-scripts/displaytime.sh 'py27,py36,py37 unit' $start_time

buildspec.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ phases:
1111

1212
# run integration tests
1313
- start_time=`date +%s`
14-
- execute-command-if-has-matching-changes "python3 -u ci-scripts/queue_build.py" "tests/integ" "tests/scripts" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "setup.py" "setup.cfg" "buildspec.yml"
14+
- execute-command-if-has-matching-changes "python3.7 -u ci-scripts/queue_build.py" "tests/integ" "tests/scripts" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "setup.py" "setup.cfg" "buildspec.yml"
1515
- ./ci-scripts/displaytime.sh 'build queue' $start_time
1616

1717
- start_time=`date +%s`
1818
- |
19-
execute-command-if-has-matching-changes "env -u AWS_DEFAULT_REGION tox -e py36 -- tests/integ -m \"not local_mode\" -n 512 --reruns 3 --reruns-delay 5 --durations 50 --boto-config '{\"region_name\": \"us-east-2\"}'" "tests/integ" "tests/scripts" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "setup.py" "setup.cfg" "buildspec.yml"
20-
- ./ci-scripts/displaytime.sh 'py36 tests/integ' $start_time
19+
execute-command-if-has-matching-changes "env -u AWS_DEFAULT_REGION tox -e py37 -- tests/integ -m \"not local_mode\" -n 512 --reruns 3 --reruns-delay 5 --durations 50 --boto-config '{\"region_name\": \"us-east-2\"}'" "tests/integ" "tests/scripts" "tests/data" "tests/conftest.py" "tests/__init__.py" "src/*.py" "setup.py" "setup.cfg" "buildspec.yml"
20+
- ./ci-scripts/displaytime.sh 'py37 tests/integ' $start_time
2121

2222
post_build:
2323
finally:

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def read_version():
101101
"Programming Language :: Python",
102102
"Programming Language :: Python :: 2.7",
103103
"Programming Language :: Python :: 3.6",
104+
"Programming Language :: Python :: 3.7",
104105
],
105106
install_requires=required_packages,
106107
extras_require=extras,

src/sagemaker/tensorflow/estimator.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@ def __init__(self, estimator, logdir=None):
7373
@staticmethod
7474
def _cmd_exists(cmd):
7575
"""Placeholder docstring"""
76-
return any(
77-
os.access(os.path.join(path, cmd), os.X_OK)
78-
for path in os.environ["PATH"].split(os.pathsep)
79-
)
76+
for path in os.environ["PATH"].split(os.pathsep):
77+
try:
78+
if os.access(os.path.join(path, cmd), os.X_OK):
79+
return True
80+
except StopIteration:
81+
return False
82+
return False
8083

8184
@staticmethod
8285
def _sync_directories(from_directory, to_directory):

tox.ini

+1-1
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
7+
envlist = black-format,flake8,pylint,twine,sphinx,doc8,py27,py36,py37
88

99
skip_missing_interpreters = False
1010

0 commit comments

Comments
 (0)