Skip to content
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

runtime: Add python3.9 support #260

Merged
merged 6 commits into from
Aug 16, 2021
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
9 changes: 8 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ environment:
LINE_COVERAGE: '72'
NEW_FLAKE8: 1
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
- PYTHON: "C:\\Python39-x64"
PYTHON_VERSION: '3.9'
PYTHON_ARCH: '64'
LINE_COVERAGE: '72'
NEW_FLAKE8: 1
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"



build: off
Expand All @@ -42,7 +49,7 @@ for:
-
matrix:
only:
- image: Visual Studio 2017
- image: Visual Studio 2019

environment:
GOPATH: c:\gopath
Expand Down
9 changes: 8 additions & 1 deletion aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ def __init__(self, version):


def get_lambda_abi(runtime):
supported = {"python2.7": "cp27mu", "python3.6": "cp36m", "python3.7": "cp37m", "python3.8": "cp38"}
supported = {
"python2.7": "cp27mu",
"python3.6": "cp36m",
"python3.7": "cp37m",
"python3.8": "cp38",
"python3.9": "cp39",
}

if runtime not in supported:
raise UnsupportedPythonVersion(runtime)
Expand Down Expand Up @@ -164,6 +170,7 @@ class DependencyBuilder(object):
"cp36m": (2, 17),
"cp37m": (2, 17),
"cp38": (2, 26),
"cp39": (2, 26),
}
# Fallback version if we're on an unknown python version
# not in _RUNTIME_GLIBC.
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_builders/workflows/python_pip/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class PythonRuntimeValidator(object):
SUPPORTED_RUNTIMES = {"python2.7", "python3.6", "python3.7", "python3.8"}
SUPPORTED_RUNTIMES = {"python2.7", "python3.6", "python3.7", "python3.8", "python3.9"}

def __init__(self, runtime):
self.language = "python"
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/workflows/python_pip/test_python_pip.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import os
import shutil
import sys
import platform
import tempfile
from unittest import TestCase
from unittest import TestCase, skipIf
import mock

from aws_lambda_builders.builder import LambdaBuilder
from aws_lambda_builders.exceptions import WorkflowFailedError
import logging

logger = logging.getLogger("aws_lambda_builders.workflows.python_pip.workflow")
IS_WINDOWS = platform.system().lower() == "windows"


class TestPythonPipWorkflow(TestCase):
Expand Down Expand Up @@ -44,6 +46,7 @@ def setUp(self):
"python3.7": "python2.7",
"python2.7": "python3.8",
"python3.8": "python2.7",
"python3.9": "python2.7",
}

def tearDown(self):
Expand Down Expand Up @@ -84,6 +87,7 @@ def test_runtime_validate_python_project_fail_open_unsupported_runtime(self):
self.source_dir, self.artifacts_dir, self.scratch_dir, self.manifest_path_valid, runtime="python2.8"
)

@skipIf(IS_WINDOWS, "Skip in windows tests")
def test_must_resolve_local_dependency(self):
source_dir = os.path.join(self.source_dir, "local-dependencies")
manifest = os.path.join(source_dir, "requirements.txt")
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/workflows/python_pip/test_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def test_get_lambda_abi_python37(self):
def test_get_lambda_abi_python38(self):
assert "cp38" == get_lambda_abi("python3.8")

def test_get_lambda_abi_python39(self):
assert "cp39" == get_lambda_abi("python3.9")


class TestPythonPipDependencyBuilder(object):
def test_can_call_dependency_builder(self, osutils):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/workflows/python_pip/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestPythonRuntimeValidator(TestCase):
def setUp(self):
self.validator = PythonRuntimeValidator(runtime="python3.7")

@parameterized.expand(["python2.7", "python3.6", "python3.7", "python3.8"])
@parameterized.expand(["python2.7", "python3.6", "python3.7", "python3.8", "python3.9"])
def test_supported_runtimes(self, runtime):
validator = PythonRuntimeValidator(runtime=runtime)
self.assertTrue(validator.has_runtime())
Expand Down