Skip to content

Commit 77af5f4

Browse files
committed
Merge branch 'master' into saieshwarm-patch-1
2 parents a52f865 + d65ce59 commit 77af5f4

File tree

10 files changed

+66
-16
lines changed

10 files changed

+66
-16
lines changed

.github/workflows/pr-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python: [ "3.8", "3.9", "3.10", "3.11" ]
16+
python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
1717
steps:
1818
- uses: actions/checkout@v3
1919
- name: Set up Python ${{ matrix.python }}
@@ -42,3 +42,5 @@ jobs:
4242
run: ./e2e-test.sh python310
4343
- name: End to End Resource Packaging Test Python 3.11
4444
run: ./e2e-test.sh python311
45+
- name: End to End Resource Packaging Test Python 3.12
46+
run: ./e2e-test.sh python312

.pre-commit-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: black
1313
exclude: templates/
1414
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.4.0
15+
rev: v4.5.0
1616
hooks:
1717
- id: check-case-conflict
1818
- id: end-of-file-fixer
@@ -34,7 +34,6 @@ repos:
3434
additional_dependencies:
3535
- flake8-bugbear>=19.3.0
3636
- flake8-builtins>=1.4.1
37-
- flake8-commas>=2.0.0
3837
- flake8-comprehensions>=2.1.0
3938
- flake8-debugger>=3.1.0
4039
- flake8-pep3101>=1.2.1
@@ -52,7 +51,7 @@ repos:
5251
- id: bandit
5352
files: ^(src|python)/
5453
- repo: https://github.com/pre-commit/mirrors-mypy
55-
rev: v1.5.1
54+
rev: v1.7.0
5655
hooks:
5756
- id: mypy
5857
files: ^src/

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ What's the name of your resource type?
3939
Select a language for code generation:
4040
[1] java
4141
[2] csharp
42-
[3] python36
43-
[4] python37
42+
[3] python38
43+
[4] python39
44+
[5] python310
45+
[6] python311
46+
[7] python312
4447
(enter an integer):
4548
>> 4
4649
Use docker for platform-independent packaging (Y/n)?

python/rpdk/python/codegen.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,3 +446,9 @@ class Python311LanguagePlugin(_PythonLanguagePlugin):
446446
NAME = "python311"
447447
RUNTIME = "python3.11"
448448
DOCKER_TAG = 3.11
449+
450+
451+
class Python312LanguagePlugin(_PythonLanguagePlugin):
452+
NAME = "python312"
453+
RUNTIME = "python3.12"
454+
DOCKER_TAG = 3.12

python/rpdk/python/parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ def setup_subparser_python310(subparsers, parents):
4444

4545
def setup_subparser_python311(subparsers, parents):
4646
return setup_subparser(subparsers, parents, "python311", "3.11")
47+
48+
49+
def setup_subparser_python312(subparsers, parents):
50+
return setup_subparser(subparsers, parents, "python312", "3.12")

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,20 @@ def find_version(*file_paths):
3737
include_package_data=True,
3838
zip_safe=True,
3939
python_requires=">=3.8",
40-
install_requires=["cloudformation-cli>=0.2.26", "types-dataclasses>=0.1.5"],
40+
install_requires=[
41+
"cloudformation-cli>=0.2.26",
42+
"types-dataclasses>=0.1.5",
43+
],
4144
entry_points={
4245
"rpdk.v1.languages": [
46+
"python312 = rpdk.python.codegen:Python312LanguagePlugin",
4347
"python311 = rpdk.python.codegen:Python311LanguagePlugin",
4448
"python310 = rpdk.python.codegen:Python310LanguagePlugin",
4549
"python39 = rpdk.python.codegen:Python39LanguagePlugin",
4650
"python38 = rpdk.python.codegen:Python38LanguagePlugin",
4751
],
4852
"rpdk.v1.parsers": [
53+
"python312 = rpdk.python.parser:setup_subparser_python312",
4954
"python311 = rpdk.python.parser:setup_subparser_python311",
5055
"python310 = rpdk.python.parser:setup_subparser_python310",
5156
"python39 = rpdk.python.parser:setup_subparser_python39",
@@ -67,6 +72,7 @@ def find_version(*file_paths):
6772
"Programming Language :: Python :: 3.9",
6873
"Programming Language :: Python :: 3.10",
6974
"Programming Language :: Python :: 3.11",
75+
"Programming Language :: Python :: 3.12",
7076
],
7177
keywords="Amazon Web Services AWS CloudFormation",
7278
)

src/cloudformation_cli_python_lib/hook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def test_entrypoint(
152152
return e.to_progress_event()
153153
except Exception: # pylint: disable=broad-except
154154
LOG.exception("Exception caught")
155-
except BaseException: # pylint: disable=broad-except
155+
except BaseException: # pylint: disable=broad-except # noqa: B036
156156
LOG.critical("Base exception caught (this is usually bad)", exc_info=True)
157157
return ProgressEvent.failed(HandlerErrorCode.InternalFailure, msg)
158158

@@ -260,7 +260,7 @@ def print_or_log(message: str) -> None:
260260
except Exception as e: # pylint: disable=broad-except
261261
print_or_log(f"Exception caught {e}")
262262
progress = ProgressEvent.failed(HandlerErrorCode.InternalFailure)
263-
except BaseException as e: # pylint: disable=broad-except
263+
except BaseException as e: # pylint: disable=broad-except # noqa: B036
264264
print_or_log(f"Base exception caught (this is usually bad) {e}")
265265
progress = ProgressEvent.failed(HandlerErrorCode.InternalFailure)
266266

src/cloudformation_cli_python_lib/resource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def test_entrypoint(
133133
return e.to_progress_event()
134134
except Exception: # pylint: disable=broad-except
135135
LOG.exception("Exception caught")
136-
except BaseException: # pylint: disable=broad-except
136+
except BaseException: # pylint: disable=broad-except # noqa: B036
137137
LOG.critical("Base exception caught (this is usually bad)", exc_info=True)
138138
return ProgressEvent.failed(HandlerErrorCode.InternalFailure, msg)
139139

@@ -229,7 +229,7 @@ def print_or_log(message: str) -> None:
229229
except Exception as e: # pylint: disable=broad-except
230230
print_or_log(f"Exception caught {e}")
231231
progress = ProgressEvent.failed(HandlerErrorCode.InternalFailure)
232-
except BaseException as e: # pylint: disable=broad-except
232+
except BaseException as e: # pylint: disable=broad-except # noqa: B036
233233
print_or_log(f"Base exception caught (this is usually bad) {e}")
234234
progress = ProgressEvent.failed(HandlerErrorCode.InternalFailure)
235235

src/setup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
# package_data -> use MANIFEST.in instead
1313
include_package_data=True,
1414
zip_safe=True,
15-
python_requires=">=3.6",
15+
python_requires=">=3.8",
1616
install_requires=[
17-
"boto3>=1.10.20",
18-
'dataclasses;python_version<"3.7"',
17+
"boto3>=1.34.6",
1918
],
2019
license="Apache License 2.0",
2120
classifiers=[
@@ -27,12 +26,11 @@
2726
"Topic :: Software Development :: Code Generators",
2827
"Operating System :: OS Independent",
2928
"Programming Language :: Python :: 3 :: Only",
30-
"Programming Language :: Python :: 3.6",
31-
"Programming Language :: Python :: 3.7",
3229
"Programming Language :: Python :: 3.8",
3330
"Programming Language :: Python :: 3.9",
3431
"Programming Language :: Python :: 3.10",
3532
"Programming Language :: Python :: 3.11",
33+
"Programming Language :: Python :: 3.12",
3634
],
3735
keywords="Amazon Web Services AWS CloudFormation",
3836
)

tests/plugin/parser_test.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
setup_subparser_python39,
77
setup_subparser_python310,
88
setup_subparser_python311,
9+
setup_subparser_python312,
910
)
1011

1112

@@ -131,3 +132,34 @@ def test_setup_subparser_python311():
131132

132133
with pytest.raises(SystemExit):
133134
sub_parser.parse_args(["--no-docker", "--use-docker"])
135+
136+
137+
def test_setup_subparser_python312():
138+
parser = argparse.ArgumentParser()
139+
subparsers = parser.add_subparsers(dest="subparser_name")
140+
141+
sub_parser = setup_subparser_python312(subparsers, [])
142+
143+
args = sub_parser.parse_args([])
144+
145+
assert args.language == "python312"
146+
assert args.use_docker is False
147+
assert args.no_docker is False
148+
149+
short_args = sub_parser.parse_args(["-d"])
150+
assert short_args.language == "python312"
151+
assert short_args.use_docker is True
152+
assert short_args.no_docker is False
153+
154+
long_args = sub_parser.parse_args(["--use-docker"])
155+
assert long_args.language == "python312"
156+
assert long_args.use_docker is True
157+
assert long_args.no_docker is False
158+
159+
no_docker = sub_parser.parse_args(["--no-docker"])
160+
assert no_docker.language == "python312"
161+
assert no_docker.use_docker is False
162+
assert no_docker.no_docker is True
163+
164+
with pytest.raises(SystemExit):
165+
sub_parser.parse_args(["--no-docker", "--use-docker"])

0 commit comments

Comments
 (0)