diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 1d510aa63..d1fd903f5 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,7 +1,7 @@ ## Context - + ## Expected Behavior diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index dada7a22a..a46c8a28c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -20,7 +20,7 @@ Before you submit this PR, please make sure that you meet these criteria: * Did you **make sure this code actually works on Lambda**, as well as locally? -* Did you test this code with all of **Python 3.7**, **Python 3.8** and **Python 3.9** ? +* Did you test this code with all of **Python 3.7**, **Python 3.8**, **Python 3.9** and **Python 3.10** ? * Does this commit ONLY relate to the issue at hand and have your linter shit all over the code? diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index e433735c1..a3cf7e96d 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -15,10 +15,10 @@ jobs: steps: - name: Checkout Code Repository uses: actions/checkout@v2 - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" - name: Install `pypa/build` run: python -m pip install build - name: Build sdist and wheel diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 708f93098..dd07d0c17 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python: [3.7, 3.8, 3.9] + python: [3.7, 3.8, 3.9, "3.10"] steps: - name: Checkout Code Repository uses: actions/checkout@v2 diff --git a/README.md b/README.md index 48db0eb85..3fb2283c8 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ __Awesome!__ ## Installation and Configuration -_Before you begin, make sure you are running Python 3.7/3.8/3.9 and you have a valid AWS account and your [AWS credentials file](https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs) is properly installed._ +_Before you begin, make sure you are running Python 3.7/3.8/3.9/3.10 and you have a valid AWS account and your [AWS credentials file](https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs) is properly installed._ **Zappa** can easily be installed through pip, like so: @@ -447,7 +447,7 @@ For instance, suppose you have a basic application in a file called "my_app.py", Any remote print statements made and the value the function returned will then be printed to your local console. **Nifty!** -You can also invoke interpretable Python 3.7/3.8/3.9 strings directly by using `--raw`, like so: +You can also invoke interpretable Python 3.7/3.8/3.9/3.10 strings directly by using `--raw`, like so: $ zappa invoke production "print(1 + 2 + 3)" --raw @@ -988,7 +988,7 @@ to change Zappa's behavior. Use these at your own risk! "role_name": "MyLambdaRole", // Name of Zappa execution role. Default --ZappaExecutionRole. To use a different, pre-existing policy, you must also set manage_roles to false. "role_arn": "arn:aws:iam::12345:role/app-ZappaLambdaExecutionRole", // ARN of Zappa execution role. Default to None. To use a different, pre-existing policy, you must also set manage_roles to false. This overrides role_name. Use with temporary credentials via GetFederationToken. "route53_enabled": true, // Have Zappa update your Route53 Hosted Zones when certifying with a custom domain. Default true. - "runtime": "python3.9", // Python runtime to use on Lambda. Can be one of "python3.7", "python3.8", or "python3.9". Defaults to whatever the current Python being used is. + "runtime": "python3.10", // Python runtime to use on Lambda. Can be one of "python3.7", "python3.8", "python3.9", or "python3.10". Defaults to whatever the current Python being used is. "s3_bucket": "dev-bucket", // Zappa zip bucket, "slim_handler": false, // Useful if project >50M. Set true to just upload a small handler to Lambda and load actual project from S3 at runtime. Default false. "settings_file": "~/Projects/MyApp/settings/dev_settings.py", // Server side settings file location, diff --git a/setup.py b/setup.py index 53960a826..e68926ac7 100755 --- a/setup.py +++ b/setup.py @@ -47,6 +47,7 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", diff --git a/tests/tests.py b/tests/tests.py index 586c953e7..8cc632966 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -170,6 +170,33 @@ def test_get_manylinux_python39(self): self.assertTrue(os.path.isfile(path)) os.remove(path) + def test_get_manylinux_python310(self): + z = Zappa(runtime="python3.10") + self.assertIsNotNone(z.get_cached_manylinux_wheel("psycopg2-binary", "2.9.1")) + self.assertIsNone(z.get_cached_manylinux_wheel("derp_no_such_thing", "0.0")) + + # mock with a known manylinux wheel package so that code for downloading them gets invoked + mock_installed_packages = {"psycopg2-binary": "2.9.1"} + with mock.patch( + "zappa.core.Zappa.get_installed_packages", + return_value=mock_installed_packages, + ): + z = Zappa(runtime="python3.10") + path = z.create_lambda_zip(handler_file=os.path.realpath(__file__)) + self.assertTrue(os.path.isfile(path)) + os.remove(path) + + # same, but with an ABI3 package + mock_installed_packages = {"cryptography": "2.8"} + with mock.patch( + "zappa.core.Zappa.get_installed_packages", + return_value=mock_installed_packages, + ): + z = Zappa(runtime="python3.10") + path = z.create_lambda_zip(handler_file=os.path.realpath(__file__)) + self.assertTrue(os.path.isfile(path)) + os.remove(path) + def test_getting_installed_packages(self, *args): z = Zappa(runtime="python3.7") diff --git a/zappa/__init__.py b/zappa/__init__.py index cd60f2701..2a323de4c 100644 --- a/zappa/__init__.py +++ b/zappa/__init__.py @@ -12,7 +12,7 @@ def running_in_docker() -> bool: return running_in_docker_flag -SUPPORTED_VERSIONS = [(3, 7), (3, 8), (3, 9)] +SUPPORTED_VERSIONS = [(3, 7), (3, 8), (3, 9), (3, 10)] MINIMUM_SUPPORTED_MINOR_VERSION = 7 if not running_in_docker() and sys.version_info[:2] not in SUPPORTED_VERSIONS: diff --git a/zappa/core.py b/zappa/core.py index 6bee528ef..b01a03a9d 100644 --- a/zappa/core.py +++ b/zappa/core.py @@ -312,8 +312,10 @@ def __init__( # The 'm' has been dropped in python 3.8+ since builds with and without pymalloc are ABI compatible # See https://github.com/pypa/manylinux for a more detailed explanation self.manylinux_suffix_start = "cp38" - else: + elif self.runtime == "python3.9": self.manylinux_suffix_start = "cp39" + else: + self.manylinux_suffix_start = "cp310" # AWS Lambda supports manylinux1/2010, manylinux2014, and manylinux_2_24 manylinux_suffixes = ("_2_24", "2014", "2010", "1") diff --git a/zappa/utilities.py b/zappa/utilities.py index 43e144b5d..b1da8474c 100644 --- a/zappa/utilities.py +++ b/zappa/utilities.py @@ -212,8 +212,10 @@ def get_runtime_from_python_version(): return "python3.7" elif sys.version_info[1] <= 8: return "python3.8" - else: + elif sys.version_info[1] <= 9: return "python3.9" + else: + return "python3.10" ##