mirror of https://github.com/pulumi/pulumi.git
e65c2aa368
Presently, the Python SDK incorrectly emits deprecation warnings for properties even if user code does not reference them. This is due to various pieces of code in the SDK that enumerate properties e.g. for the purpose of serialisation/RPC calls. In enumerating properties, their getters are invoked, triggering the deprecation warnings. There isn't currently a way for us to detect which properties may or may not be deprecated and handle them appropriately, so this commit introduces one. Deprecation messages are moved into a new decorator, `@pulumi.deprecated`. This decorator accepts a `Callable` and wraps it, making two changes: * Before the decorated `Callable`'s execution, deprecation messages are printed. * The returned `Callable` is tagged with a new reserved property, `_pulumi_deprecated_callable`, which references the wrapped `Callable` (that is, the original `Callable` whose invocation will _not_ produce deprecation warnings). With this in place, we subsequently make the following two changes: * We modify the SDK enumeration code (specifically that in `input_type_to_dict` to check for `_pulumi_deprecated_callable` properties and use them where appropriate to invoke getters without triggering deprecation warnings. * We modify Python code generation so that instead of emitting statements to print deprecation warnings, we simply emit applications of the `@pulumi.deprecated` decorator instead. This commit adds some Python unit tests to exercise the decorator and manual testing has been performed using the AWS Classic SDK. Fixes #15894 |
||
---|---|---|
.. | ||
gen_program_test | ||
.gitignore | ||
doc.go | ||
gen.go | ||
gen_intrinsics.go | ||
gen_program.go | ||
gen_program_expressions.go | ||
gen_program_lower.go | ||
gen_program_quotes.go | ||
gen_program_quotes_test.go | ||
gen_program_test.go | ||
gen_program_utils.go | ||
gen_resource_mappings.go | ||
gen_resource_mappings_test.go | ||
gen_test.go | ||
importer.go | ||
pyproject.go | ||
python.go | ||
python_test.go | ||
requirements.txt | ||
test.go | ||
utilities.go | ||
utilities.py | ||
utilities_test.go |