From 6f86e960c08f8575fb0d0ea8574bdcb447ac7dc8 Mon Sep 17 00:00:00 2001 From: Daniel Sullivan Date: Fri, 18 Mar 2022 09:03:57 -0500 Subject: [PATCH 1/4] feat: add support for python 3.8 and 3.9, switched docker image to mlupin/docker-lambda --- python/rpdk/python/codegen.py | 14 +++++++++++++- python/rpdk/python/parser.py | 8 ++++++++ setup.py | 4 ++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/python/rpdk/python/codegen.py b/python/rpdk/python/codegen.py index db24c17..7546b52 100644 --- a/python/rpdk/python/codegen.py +++ b/python/rpdk/python/codegen.py @@ -171,7 +171,7 @@ def generate(self, project): if project.configuration_schema: configuration_schema_path = ( - project.root / project.configuration_schema_filename + project.root / project.configuration_schema_filename ) project.write_configuration_schema(configuration_schema_path) configuration_models = resolve_models( @@ -354,3 +354,15 @@ class Python37LanguagePlugin(Python36LanguagePlugin): NAME = "python37" RUNTIME = "python3.7" DOCKER_TAG = 3.7 + + +class Python38LanguagePlugin(Python36LanguagePlugin): + NAME = "python38" + RUNTIME = "python3.8" + DOCKER_TAG = 3.8 + + +class Python39LanguagePlugin(Python36LanguagePlugin): + NAME = "python39" + RUNTIME = "python3.9" + DOCKER_TAG = 3.9 diff --git a/python/rpdk/python/parser.py b/python/rpdk/python/parser.py index 01d398b..d2c0d88 100644 --- a/python/rpdk/python/parser.py +++ b/python/rpdk/python/parser.py @@ -27,3 +27,11 @@ def setup_subparser_python36(subparsers, parents): def setup_subparser_python37(subparsers, parents): return setup_subparser(subparsers, parents, "python37") + + +def setup_subparser_python38(subparsers, parents): + return setup_subparser(subparsers, parents, "python38") + + +def setup_subparser_python39(subparsers, parents): + return setup_subparser(subparsers, parents, "python39") diff --git a/setup.py b/setup.py index 4698d2a..22b9c9f 100644 --- a/setup.py +++ b/setup.py @@ -40,10 +40,14 @@ def find_version(*file_paths): install_requires=["cloudformation-cli>=0.2.26", "types-dataclasses>=0.1.5"], entry_points={ "rpdk.v1.languages": [ + "python39 = rpdk.python.codegen:Python39LanguagePlugin", + "python38 = rpdk.python.codegen:Python38LanguagePlugin", "python37 = rpdk.python.codegen:Python37LanguagePlugin", "python36 = rpdk.python.codegen:Python36LanguagePlugin", ], "rpdk.v1.parsers": [ + "python39 = rpdk.python.parser:setup_subparser_python39", + "python38 = rpdk.python.parser:setup_subparser_python38", "python37 = rpdk.python.parser:setup_subparser_python37", "python36 = rpdk.python.parser:setup_subparser_python36", ], From 9acb5d888c61de8799e642a12722ca6ec9cae3d4 Mon Sep 17 00:00:00 2001 From: Daniel Sullivan Date: Fri, 18 Mar 2022 09:25:46 -0500 Subject: [PATCH 2/4] missed tests fixed --- python/rpdk/python/codegen.py | 2 +- tests/plugin/parser_test.py | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/python/rpdk/python/codegen.py b/python/rpdk/python/codegen.py index 7546b52..efe3e37 100644 --- a/python/rpdk/python/codegen.py +++ b/python/rpdk/python/codegen.py @@ -171,7 +171,7 @@ def generate(self, project): if project.configuration_schema: configuration_schema_path = ( - project.root / project.configuration_schema_filename + project.root / project.configuration_schema_filename ) project.write_configuration_schema(configuration_schema_path) configuration_models = resolve_models( diff --git a/tests/plugin/parser_test.py b/tests/plugin/parser_test.py index d058da5..cc18014 100644 --- a/tests/plugin/parser_test.py +++ b/tests/plugin/parser_test.py @@ -1,5 +1,10 @@ import argparse -from rpdk.python.parser import setup_subparser_python36, setup_subparser_python37 +from rpdk.python.parser import ( + setup_subparser_python36, + setup_subparser_python37, + setup_subparser_python38, + setup_subparser_python39, +) def test_setup_subparser_python36(): @@ -24,3 +29,27 @@ def test_setup_subparser_python37(): assert args.language == "python37" assert args.use_docker is False + + +def test_setup_subparser_python38(): + parser = argparse.ArgumentParser() + subparsers = parser.add_subparsers(dest="subparser_name") + + sub_parser = setup_subparser_python38(subparsers, []) + + args = sub_parser.parse_args([]) + + assert args.language == "python38" + assert args.use_docker is False + + +def test_setup_subparser_python39(): + parser = argparse.ArgumentParser() + subparsers = parser.add_subparsers(dest="subparser_name") + + sub_parser = setup_subparser_python39(subparsers, []) + + args = sub_parser.parse_args([]) + + assert args.language == "python39" + assert args.use_docker is False From 478445c9c7eb4435ca8d9b99797c5f3c7c12fd5d Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Thu, 13 Oct 2022 10:15:29 -0700 Subject: [PATCH 3/4] More items for python 3.8 and 3.9 support --- .github/workflows/pr-ci.yml | 4 ++++ python/rpdk/python/parser.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 3f5dea3..b50bbcb 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -38,3 +38,7 @@ jobs: run: ./e2e-test.sh python36 - name: End to End Resource Packaging Test Python 3.7 run: ./e2e-test.sh python37 + - name: End to End Resource Packaging Test Python 3.8 + run: ./e2e-test.sh python38 + - name: End to End Resource Packaging Test Python 3.9 + run: ./e2e-test.sh python39 diff --git a/python/rpdk/python/parser.py b/python/rpdk/python/parser.py index d2c0d88..518dbcb 100644 --- a/python/rpdk/python/parser.py +++ b/python/rpdk/python/parser.py @@ -1,9 +1,9 @@ -def setup_subparser(subparsers, parents, python_version): +def setup_subparser(subparsers, parents, python_version, python_version_number): parser = subparsers.add_parser( python_version, - description="""This sub command generates IDE and build files for Python {} - """.format( - "3.6" if python_version == "python36" else "3.7" + description=( + "This sub command generates IDE and build files for Python " + "{}".format(python_version_number) ), parents=parents, ) @@ -22,16 +22,16 @@ def setup_subparser(subparsers, parents, python_version): def setup_subparser_python36(subparsers, parents): - return setup_subparser(subparsers, parents, "python36") + return setup_subparser(subparsers, parents, "python36", "3.6") def setup_subparser_python37(subparsers, parents): - return setup_subparser(subparsers, parents, "python37") + return setup_subparser(subparsers, parents, "python37", "3.7") def setup_subparser_python38(subparsers, parents): - return setup_subparser(subparsers, parents, "python38") + return setup_subparser(subparsers, parents, "python38", "3.8") def setup_subparser_python39(subparsers, parents): - return setup_subparser(subparsers, parents, "python39") + return setup_subparser(subparsers, parents, "python39", "3.9") From 9ecea35a1046874226a3923bd0dfd3aaebbe559e Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 23 Nov 2022 15:14:06 -0800 Subject: [PATCH 4/4] Remove python 3.6 --- .github/workflows/pr-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index b50bbcb..e12ce2c 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python: [ 3.6, 3.7, 3.8, 3.9 ] + python: [ 3.7, 3.8, 3.9 ] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python }}