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

fix(cli): fix Python sample-app template #3071

Merged
merged 1 commit into from
Jun 26, 2019
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
6 changes: 3 additions & 3 deletions packages/aws-cdk/lib/init-templates/sample-app/python/app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3

from aws_cdk import cdk
from aws_cdk import core

from hello.hello_stack import MyStack


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

app.run()
app.synth()
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from aws_cdk import (
aws_iam as iam,
aws_s3 as s3,
cdk,
core,
)


class HelloConstruct(cdk.Construct):
class HelloConstruct(core.Construct):

@property
def buckets(self):
return tuple(self._buckets)

def __init__(self, scope: cdk.Construct, id: str, num_buckets: int) -> None:
def __init__(self, scope: core.Construct, id: str, num_buckets: int) -> None:
super().__init__(scope, id)
self._buckets = []
for i in range(0, num_buckets):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
aws_sqs as sqs,
aws_sns as sns,
aws_sns_subscriptions as subs,
cdk
core
)

from hello_construct import HelloConstruct


class MyStack(cdk.Stack):
class MyStack(core.Stack):

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

queue = sqs.Queue(
self, "MyFirstQueue",
visibility_timeout_sec=300,
visibility_timeout=core.Duration.seconds(300),
)

topic = sns.Topic(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
packages=setuptools.find_packages(where="hello"),

install_requires=[
"aws-cdk.cdk",
"aws-cdk.core",
"aws-cdk.aws_iam",
"aws-cdk.aws_sqs",
"aws-cdk.aws_sns",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import unittest

from aws_cdk import cdk
from aws_cdk import core

from hello.hello_construct import HelloConstruct

class TestHelloConstruct(unittest.TestCase):

def setUp(self):
self.app = cdk.App()
self.stack = cdk.Stack(self.app, "TestStack")
self.app = core.App()
self.stack = core.Stack(self.app, "TestStack")

def test_num_buckets(self):
num_buckets = 10
Expand Down