-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] TypedDict input types #4936
Labels
Milestone
Comments
julienp
added a commit
to pulumi/docs
that referenced
this issue
Jul 23, 2024
Document how in Python inputs can either be argument classes or dictionary literals. Ref pulumi/registry#4936
julienp
added a commit
to pulumi/docs
that referenced
this issue
Jul 23, 2024
Document how in Python inputs can either be argument classes or dictionary literals. Ref pulumi/registry#4936
julienp
added a commit
to pulumi/pulumi
that referenced
this issue
Jul 23, 2024
In Python object inputs can either be argument classes or dictionary literals. Link to the Python docs in the input section of the package docs. Fixes pulumi/registry#4936
julienp
added a commit
to pulumi/pulumi
that referenced
this issue
Jul 23, 2024
In Python object inputs can either be argument classes or dictionary literals. Link to the Python docs in the input section of the package docs. Fixes pulumi/registry#4936
julienp
added a commit
to pulumi/docs
that referenced
this issue
Jul 24, 2024
* Document Python Args and ArgsDict types Document how in Python inputs can either be argument classes or dictionary literals. Ref pulumi/registry#4936 * Apply suggestions from code review Co-authored-by: Justin Van Patten <[email protected]> --------- Co-authored-by: Justin Van Patten <[email protected]>
julienp
added a commit
to pulumi/pulumi
that referenced
this issue
Jul 30, 2024
In Python object inputs can either be argument classes or dictionary literals. Link to the Python docs in the input section of the package docs. Fixes pulumi/registry#4936
julienp
added a commit
to pulumi/pulumi
that referenced
this issue
Jul 30, 2024
In Python object inputs can either be argument classes or dictionary literals. Link to the Python docs in the input section of the package docs. Fixes pulumi/registry#4936
Showing the Instead of the clutter, we link to the python docs about inputs at the top of the section pulumi/pulumi#16763 |
github-merge-queue bot
pushed a commit
to pulumi/pulumi
that referenced
this issue
Jul 31, 2024
In Python object inputs can either be argument classes or dictionary literals. Link to the [Python input docs](https://www.pulumi.com/docs/languages-sdks/python/#inputs-and-outputs) in the input section of the package docs when the current language is python. Fixes pulumi/registry#4936 <img width="738" alt="Screenshot 2024-07-30 at 18 23 53" src="https://github.com/user-attachments/assets/3ad00f45-a81d-4c2d-b3ad-f9ae811735f6">
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Previous discussion https://docs.google.com/document/d/1BT4ILg-q-q-XgYRuDOBOYHdNIiICWcgpewMOhMdFcjE/edit
With pulumi/pulumi#12689 we have TypedDict based types for inputs. You could previously already pass dictionaries as inputs, but these did not have type checking, and we mostly discouraged using plain dictionaries (by defaulting to
Args
classes in docs and examples).Now that these are typed, we want to promote their use, and we were considering adding them to the constructor syntax in the registry docs. The option we settled on was to show the
Union[${Soemthing}Args, ${Something}ArgsDict]
.To accomplish this, we can pass
true
foracceptMapping
inGetLanguageTypeString
https://github.com/pulumi/pulumi/blob/ff1f7434aa8c899f94aa2b170cf225c012c8c66c/pkg/codegen/python/doc.go#L83The result is fairly verbose:
and also shows up in other places:
It also does not tell the user how to use these types.
I wonder if it would be better to add a conceptual explanation to the docs in the
Inputs
section (for example here https://www.pulumi.com/registry/packages/kubernetes/api-docs/apps/v1/deployment/#properties), and/or on the Python SDK page, that explains that you can either use anArgs
class or a (typed) dictionary.The text was updated successfully, but these errors were encountered: