From 796d6bb59729a59eb434aab44fb0c9cc7bdc0443 Mon Sep 17 00:00:00 2001 From: shivlaks <32604953+shivlaks@users.noreply.github.com> Date: Tue, 25 Jun 2019 23:41:17 -0700 Subject: [PATCH] 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 --- .../aws-cdk/lib/init-templates/sample-app/python/app.py | 6 +++--- .../sample-app/python/hello/hello_construct.py | 6 +++--- .../init-templates/sample-app/python/hello/hello_stack.py | 8 ++++---- .../aws-cdk/lib/init-templates/sample-app/python/setup.py | 2 +- .../sample-app/python/tests/unit/test_hello_construct.py | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/aws-cdk/lib/init-templates/sample-app/python/app.py b/packages/aws-cdk/lib/init-templates/sample-app/python/app.py index 1754ff4ab6f1b..a4753da2dc1be 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/python/app.py +++ b/packages/aws-cdk/lib/init-templates/sample-app/python/app.py @@ -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() diff --git a/packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_construct.py b/packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_construct.py index d9637d43d82a5..480d89d98eaf4 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_construct.py +++ b/packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_construct.py @@ -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): diff --git a/packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_stack.py b/packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_stack.py index cd0463ae1b647..66a873f153282 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_stack.py +++ b/packages/aws-cdk/lib/init-templates/sample-app/python/hello/hello_stack.py @@ -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( diff --git a/packages/aws-cdk/lib/init-templates/sample-app/python/setup.py b/packages/aws-cdk/lib/init-templates/sample-app/python/setup.py index 12cded454e496..2f4e2679da78e 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/python/setup.py +++ b/packages/aws-cdk/lib/init-templates/sample-app/python/setup.py @@ -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", diff --git a/packages/aws-cdk/lib/init-templates/sample-app/python/tests/unit/test_hello_construct.py b/packages/aws-cdk/lib/init-templates/sample-app/python/tests/unit/test_hello_construct.py index 4af1107c5e83b..20d06d9b2e659 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/python/tests/unit/test_hello_construct.py +++ b/packages/aws-cdk/lib/init-templates/sample-app/python/tests/unit/test_hello_construct.py @@ -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