pulumi icon indicating copy to clipboard operation
pulumi copied to clipboard

feat(codegen/python): Generate config getters with optional default arguments

Open kpitzen opened this issue 3 years ago • 4 comments

Description

Fixes #10268

Modifies the existing python codegen logic to support the new pulumi.Config.get optional default arguments. This should result in simpler looking python code when providing a default value.

Note: this PR requires https://github.com/pulumi/pulumi/pull/10344 to be merged first, otherwise we will generate invalid python from the SDK's perspective.

Checklist

  • [x] I have added tests that prove my fix is effective or that my feature works
  • [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

kpitzen avatar Aug 10 '22 19:08 kpitzen

Please view the results of the Downstream Codegen Tests Here

pulumi-bot avatar Aug 10 '22 19:08 pulumi-bot

Please view the results of the Downstream Codegen Tests Here

pulumi-bot avatar Aug 10 '22 19:08 pulumi-bot

Please view the results of the Downstream Codegen Tests Here

pulumi-bot avatar Aug 10 '22 19:08 pulumi-bot

This will mean that newly generated SDKs won't work with older versions of the Pulumi SDK, and thus moving to a new version of an SDK will be a breaking change. I don't know if we are ok with this.

CC @mikhailshilkov

The feature implementation itself looks good.

iwahbe avatar Aug 11 '22 11:08 iwahbe

Please view the results of the Downstream Codegen Tests Here

pulumi-bot avatar Aug 11 '22 13:08 pulumi-bot

Please view the results of the Downstream Codegen Tests Here

pulumi-bot avatar Aug 11 '22 13:08 pulumi-bot

@iwahbe Moving to a new version of the SDK should be non-breaking, since the old function signature is compatible with the new. This does mean that generating new python code will require moving to the new SDK, however.

kpitzen avatar Aug 11 '22 13:08 kpitzen