Skip to content

Commit 277f818

Browse files
feat: support python 3.10, update airflow dependency (aws#3327)
1 parent 17a479a commit 277f818

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ Before sending us a pull request, please ensure that:
7878
1. cd into the sagemaker-python-sdk folder: `cd sagemaker-python-sdk` or `cd /environment/sagemaker-python-sdk`
7979
1. Run the following tox command and verify that all code checks and unit tests pass: `tox tests/unit`
8080

81-
You can also run a single test with the following command: `tox -e py36 -- -s -vv <path_to_file><file_name>::<test_function_name>`
81+
You can also run a single test with the following command: `tox -e py310 -- -s -vv <path_to_file><file_name>::<test_function_name>`
8282
* Note that the coverage test will fail if you only run a single test, so make sure to surround the command with `export IGNORE_COVERAGE=-` and `unset IGNORE_COVERAGE`
83-
* Example: `export IGNORE_COVERAGE=- ; tox -e py36 -- -s -vv tests/unit/test_estimator.py::test_sagemaker_model_s3_uri_invalid ; unset IGNORE_COVERAGE`
83+
* Example: `export IGNORE_COVERAGE=- ; tox -e py310 -- -s -vv tests/unit/test_estimator.py::test_sagemaker_model_s3_uri_invalid ; unset IGNORE_COVERAGE`
8484

8585

8686
### Run the Integration Tests
@@ -89,9 +89,9 @@ Our CI system runs integration tests (the ones in the `tests/integ` directory),
8989
You should only worry about manually running any new integration tests that you write, or integration tests that test an area of code that you've modified.
9090

9191
1. Follow the instructions at [Set Up the AWS Command Line Interface (AWS CLI)](https://docs.aws.amazon.com/polly/latest/dg/setup-aws-cli.html).
92-
1. To run a test, specify the test file and method you want to run per the following command: `tox -e py36 -- -s -vv <path_to_file><file_name>::<test_function_name>`
92+
1. To run a test, specify the test file and method you want to run per the following command: `tox -e py310 -- -s -vv <path_to_file><file_name>::<test_function_name>`
9393
* Note that the coverage test will fail if you only run a single test, so make sure to surround the command with `export IGNORE_COVERAGE=-` and `unset IGNORE_COVERAGE`
94-
* Example: `export IGNORE_COVERAGE=- ; tox -e py36 -- -s -vv tests/integ/test_tf_script_mode.py::test_mnist ; unset IGNORE_COVERAGE`
94+
* Example: `export IGNORE_COVERAGE=- ; tox -e py310 -- -s -vv tests/integ/test_tf_script_mode.py::test_mnist ; unset IGNORE_COVERAGE`
9595

9696
If you are writing or modifying a test that creates a SageMaker job (training, tuner, or transform) or endpoint, it's important to assign a concurrency-friendly `job_name` (or `endpoint_name`), or your tests may fail randomly due to name collisions. We have a helper method `sagemaker.utils.unique_name_from_base(base, max_length)` that makes test-friendly names. You can find examples of how to use it [here](https://github.com/aws/sagemaker-python-sdk/blob/3816a5658d3737c9767e01bc8d37fc3ed5551593/tests/integ/test_tfs.py#L37) and
9797
[here](https://github.com/aws/sagemaker-python-sdk/blob/3816a5658d3737c9767e01bc8d37fc3ed5551593/tests/integ/test_tuner.py#L616), or by searching for "unique\_name\_from\_base" in our test code.

README.rst

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ SageMaker Python SDK is tested on:
9090
- Python 3.7
9191
- Python 3.8
9292
- Python 3.9
93+
- Python 3.10
9394

9495
AWS Permissions
9596
~~~~~~~~~~~~~~~

requirements/extras/test_requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ contextlib2==21.6.0
1111
awslogs==0.14.0
1212
black==22.3.0
1313
stopit==1.1.2
14-
apache-airflow==2.2.4
14+
apache-airflow==2.3.4
1515
apache-airflow-providers-amazon==4.0.0
1616
attrs==20.3.0
1717
fabric==2.6.0

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def read_requirements(filename):
9494
"Programming Language :: Python :: 3.7",
9595
"Programming Language :: Python :: 3.8",
9696
"Programming Language :: Python :: 3.9",
97+
"Programming Language :: Python :: 3.10",
9798
],
9899
install_requires=required_packages,
99100
extras_require=extras,

tests/integ/test_airflow_config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
import os
1616

17-
import airflow
1817
import pytest
1918
import numpy as np
19+
from airflow import utils
2020
from airflow import DAG
2121
from airflow.contrib.operators.sagemaker_training_operator import SageMakerTrainingOperator
2222
from airflow.contrib.operators.sagemaker_transform_operator import SageMakerTransformOperator
@@ -624,7 +624,7 @@ def _build_airflow_workflow(estimator, instance_type, inputs=None, mini_batch_si
624624

625625
default_args = {
626626
"owner": "airflow",
627-
"start_date": airflow.utils.dates.days_ago(2),
627+
"start_date": utils.dates.days_ago(2),
628628
"provide_context": True,
629629
}
630630

0 commit comments

Comments
 (0)