sparse-intern-71089
12/24/2022, 10:49 AMbillowy-army-68599
clever-painter-96148
12/24/2022, 1:42 PMargs = ClusterArgs(cluster_ipv4_cidr="1.2.3.4")
Cluster("composition", ClusterArgs(**args.__dict__, description="blah"))
(type checking is enforced)
pyright catches this mistake:
args = {"x": 42}
ClusterArgs(**args, description="blah")
The only issue I've found (and that I do not understand), is that pyright doesn't catch the issue when mixing different "args objects":
ClusterArgs(**ClusterReleaseChannelArgs(channel="foo").__dict__)
Of course, this fails at runtime with a TypeError:
>>> ClusterArgs(**ClusterReleaseChannelArgs(channel="foo").__dict__)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ClusterArgs.__init__() got an unexpected keyword argument 'channel'
clever-painter-96148
12/24/2022, 1:43 PMpulumi_gcp.container
here)billowy-army-68599
clever-painter-96148
12/24/2022, 5:49 PMquaint-hydrogen-7228
12/25/2022, 11:26 AMclever-painter-96148
12/25/2022, 4:51 PMclever-painter-96148
12/25/2022, 4:51 PMclever-painter-96148
12/25/2022, 4:52 PMcreamy-agency-52831
12/25/2022, 9:07 PMTypedDict
interface available is that it was not supported in Python 3.6 (which is now EOL, so we don't need to adhere to its support contracts). There were some issues with optional keys in TypedDict
as well, but upon taking a look at it now, it seems like those may have been resolved with NotRequired
. Always happy to give this another look!clever-painter-96148
12/26/2022, 9:22 AMFor historical reference, the reason we don't currently have aThat's what I expected. 🙂interface available is that it was not supported in Python 3.6TypedDict
There were some issues with optional keys inNotRequired is included in 3.11 and available in https://pypi.org/project/typing-extensions/as well, but upon taking a look at it now, it seems like those may have been resolved withTypedDict
.NotRequired