diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 2f7e9fa..74c4d68 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.8", "3.9", "3.10", "3.11" ] + python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python }} @@ -42,3 +42,5 @@ jobs: run: ./e2e-test.sh python310 - name: End to End Resource Packaging Test Python 3.11 run: ./e2e-test.sh python311 + - name: End to End Resource Packaging Test Python 3.12 + run: ./e2e-test.sh python312 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 02e9b79..39b220b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: black exclude: templates/ - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-case-conflict - id: end-of-file-fixer @@ -34,7 +34,6 @@ repos: additional_dependencies: - flake8-bugbear>=19.3.0 - flake8-builtins>=1.4.1 - - flake8-commas>=2.0.0 - flake8-comprehensions>=2.1.0 - flake8-debugger>=3.1.0 - flake8-pep3101>=1.2.1 @@ -52,7 +51,7 @@ repos: - id: bandit files: ^(src|python)/ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.7.0 hooks: - id: mypy files: ^src/ diff --git a/README.md b/README.md index 6854fe5..4892d57 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,10 @@ What's the name of your resource type? Select a language for code generation: [1] java [2] csharp -[3] python36 -[4] python37 +[3] python38 +[4] python39 +[5] python310 +[6] python311 (enter an integer): >> 4 Use docker for platform-independent packaging (Y/n)? diff --git a/python/rpdk/python/codegen.py b/python/rpdk/python/codegen.py index a82a41b..8857aa9 100644 --- a/python/rpdk/python/codegen.py +++ b/python/rpdk/python/codegen.py @@ -446,3 +446,9 @@ class Python311LanguagePlugin(_PythonLanguagePlugin): NAME = "python311" RUNTIME = "python3.11" DOCKER_TAG = 3.11 + + +class Python312LanguagePlugin(_PythonLanguagePlugin): + NAME = "python312" + RUNTIME = "python3.12" + DOCKER_TAG = 3.12 diff --git a/python/rpdk/python/parser.py b/python/rpdk/python/parser.py index 8872b5a..3e5dd85 100644 --- a/python/rpdk/python/parser.py +++ b/python/rpdk/python/parser.py @@ -44,3 +44,7 @@ def setup_subparser_python310(subparsers, parents): def setup_subparser_python311(subparsers, parents): return setup_subparser(subparsers, parents, "python311", "3.11") + + +def setup_subparser_python312(subparsers, parents): + return setup_subparser(subparsers, parents, "python312", "3.12") diff --git a/setup.py b/setup.py index d6c742e..6bc36e9 100644 --- a/setup.py +++ b/setup.py @@ -37,15 +37,20 @@ def find_version(*file_paths): include_package_data=True, zip_safe=True, python_requires=">=3.8", - install_requires=["cloudformation-cli>=0.2.26", "types-dataclasses>=0.1.5"], + install_requires=[ + "cloudformation-cli>=0.2.26", + "types-dataclasses>=0.1.5", + ], entry_points={ "rpdk.v1.languages": [ + "python312 = rpdk.python.codegen:Python312LanguagePlugin", "python311 = rpdk.python.codegen:Python311LanguagePlugin", "python310 = rpdk.python.codegen:Python310LanguagePlugin", "python39 = rpdk.python.codegen:Python39LanguagePlugin", "python38 = rpdk.python.codegen:Python38LanguagePlugin", ], "rpdk.v1.parsers": [ + "python312 = rpdk.python.parser:setup_subparser_python312", "python311 = rpdk.python.parser:setup_subparser_python311", "python310 = rpdk.python.parser:setup_subparser_python310", "python39 = rpdk.python.parser:setup_subparser_python39", @@ -67,6 +72,7 @@ def find_version(*file_paths): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], keywords="Amazon Web Services AWS CloudFormation", ) diff --git a/tests/plugin/parser_test.py b/tests/plugin/parser_test.py index 910e740..e194680 100644 --- a/tests/plugin/parser_test.py +++ b/tests/plugin/parser_test.py @@ -6,6 +6,7 @@ setup_subparser_python39, setup_subparser_python310, setup_subparser_python311, + setup_subparser_python312, ) @@ -131,3 +132,34 @@ def test_setup_subparser_python311(): with pytest.raises(SystemExit): sub_parser.parse_args(["--no-docker", "--use-docker"]) + + +def test_setup_subparser_python312(): + parser = argparse.ArgumentParser() + subparsers = parser.add_subparsers(dest="subparser_name") + + sub_parser = setup_subparser_python312(subparsers, []) + + args = sub_parser.parse_args([]) + + assert args.language == "python312" + assert args.use_docker is False + assert args.no_docker is False + + short_args = sub_parser.parse_args(["-d"]) + assert short_args.language == "python312" + assert short_args.use_docker is True + assert short_args.no_docker is False + + long_args = sub_parser.parse_args(["--use-docker"]) + assert long_args.language == "python312" + assert long_args.use_docker is True + assert long_args.no_docker is False + + no_docker = sub_parser.parse_args(["--no-docker"]) + assert no_docker.language == "python312" + assert no_docker.use_docker is False + assert no_docker.no_docker is True + + with pytest.raises(SystemExit): + sub_parser.parse_args(["--no-docker", "--use-docker"])