Skip to content

Commit 796d6bb

Browse files
shivlaksElad Ben-Israel
authored and
Elad Ben-Israel
committedJun 26, 2019
fix(cli): fix Python sample-app template (#3071)
follow up on #3058 - since we renamed the core package namesapce to "software.amazon.awscdk.core" Fixes #3069
1 parent 6d38487 commit 796d6bb

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env python3
22

3-
from aws_cdk import cdk
3+
from aws_cdk import core
44

55
from hello.hello_stack import MyStack
66

77

8-
app = cdk.App()
8+
app = core.App()
99
MyStack(app, "hello-cdk-1", env={'region': 'us-east-2'})
1010
MyStack(app, "hello-cdk-2", env={'region': 'us-west-2'})
1111

12-
app.run()
12+
app.synth()

‎packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_construct.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
from aws_cdk import (
22
aws_iam as iam,
33
aws_s3 as s3,
4-
cdk,
4+
core,
55
)
66

77

8-
class HelloConstruct(cdk.Construct):
8+
class HelloConstruct(core.Construct):
99

1010
@property
1111
def buckets(self):
1212
return tuple(self._buckets)
1313

14-
def __init__(self, scope: cdk.Construct, id: str, num_buckets: int) -> None:
14+
def __init__(self, scope: core.Construct, id: str, num_buckets: int) -> None:
1515
super().__init__(scope, id)
1616
self._buckets = []
1717
for i in range(0, num_buckets):

‎packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_stack.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
aws_sqs as sqs,
44
aws_sns as sns,
55
aws_sns_subscriptions as subs,
6-
cdk
6+
core
77
)
88

99
from hello_construct import HelloConstruct
1010

1111

12-
class MyStack(cdk.Stack):
12+
class MyStack(core.Stack):
1313

14-
def __init__(self, app: cdk.App, id: str, **kwargs) -> None:
14+
def __init__(self, app: core.App, id: str, **kwargs) -> None:
1515
super().__init__(app, id, **kwargs)
1616

1717
queue = sqs.Queue(
1818
self, "MyFirstQueue",
19-
visibility_timeout_sec=300,
19+
visibility_timeout=core.Duration.seconds(300),
2020
)
2121

2222
topic = sns.Topic(

‎packages/aws-cdk/lib/init-templates/sample-app/python/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
packages=setuptools.find_packages(where="hello"),
2020

2121
install_requires=[
22-
"aws-cdk.cdk",
22+
"aws-cdk.core",
2323
"aws-cdk.aws_iam",
2424
"aws-cdk.aws_sqs",
2525
"aws-cdk.aws_sns",

‎packages/aws-cdk/lib/init-templates/sample-app/python/tests/unit/test_hello_construct.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import unittest
22

3-
from aws_cdk import cdk
3+
from aws_cdk import core
44

55
from hello.hello_construct import HelloConstruct
66

77
class TestHelloConstruct(unittest.TestCase):
88

99
def setUp(self):
10-
self.app = cdk.App()
11-
self.stack = cdk.Stack(self.app, "TestStack")
10+
self.app = core.App()
11+
self.stack = core.Stack(self.app, "TestStack")
1212

1313
def test_num_buckets(self):
1414
num_buckets = 10

0 commit comments

Comments
 (0)