pulumi/tests/testdata/codegen/regress-py-tfbridge-611
Will Jones 271553d462
Generate `@deprecated` decorators in Python SDKs (#16436)
The latest version of the core Pulumi SDK contains a decorator,
`@deprecated`, that is used when generating SDK code in order to signify
deprecated properties in a way that can be recognised by other SDK code.
This is useful when writing generic Python code that e.g. traverses
class properties without triggering deprecation warnings for those not
explicitly mentioned in user code. The [original pull
request](https://github.com/pulumi/pulumi/pull/16400) has more details.

Alas, we can't rely on the fact that a user will upgrade _both_ a
particular (generated) provider SDK and the core Pulumi SDK at the same
time. Thus, it's entirely possible that a user bumps their version of
(say) `pulumi_aws`, whilst leaving their `pulumi` library at the same
(compatible, according to specified bounds) version. In doing so they'd
hit errors when the new SDK tried to import the `@deprecated` decorator,
which doesn't exist in the old core SDK.

This commit thus fixes this by altering code generation so that each SDK
receives its own inlined copy of the `@deprecated` decorator, which it
can reference regardless of the version of the core SDK. This decorator
applies the same `_pulumi_deprecated_callable` tag to functions it
decorates, which a sufficiently modern SDK will recognise to avoid
triggering e.g. https://github.com/pulumi/pulumi/issues/15894. Later on,
we can hopefully find a way to avoid doing this and use only a version
of `@deprecated` specified in the core SDK.

Codegen tests have been updated and the inlined decorator has manually
been tested using the AWS Classic SDK.

Addresses
https://github.com/pulumi/pulumi/pull/16400#discussion_r1646562455
2024-06-21 11:34:29 +00:00
..
python Generate `@deprecated` decorators in Python SDKs (#16436) 2024-06-21 11:34:29 +00:00
schema.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00