awsdocs / aws-cdk-guide

User guide for the AWS Cloud Development Kit (CDK).
Other
335 stars 222 forks source link

Inconsistent python imports #282

Closed telenieko closed 4 years ago

telenieko commented 4 years ago

Hi,

The doc_source/work-with-cdk-python.md file says:

We recommend the following practices when importing AWS CDK (...) Generally, import individual classes from aws_cdk.core.

from aws_cdk.core import App, Construct

If you need many classes from the core module, you may use a namespace alias of cdk instead of importing individual classes. Avoid doing both.

import aws_cdk.core as cdk

But this is not being followed in parts of the documentation, for example in environments.md aws_cdk.core is used in the examples as if it had been imported as import aws_cdk.core as core:

env_EU = core.Environment(account="8373873873", region="eu-west-1")
env_USA = core.Environment(account="2383838383", region="us-west-2")
...
MyDevStack(app, "dev", env=core.Environment(
    account=os.environ["CDK_DEFAULT_ACCOUNT"],
    region=os.environ["CDK_DEFAULT_REGION"]))

The examples do not include the import statements which makes things more confusing!

Anyway, CDK is awesome!

ghost commented 4 years ago

@telenieko There are definitely still some inconsistencies around imports in the code snippets. I have an open issue to address this and work is underway. I don't have a timeline for completion at this time.

https://github.com/awsdocs/aws-cdk-guide/issues/268

As this is a subset of that issue, I'm going to close this one. Feel free to participate on the other issue if you have additional comments.