Visitar URL original
Implement MultiArgumentInputs for functions in Python SDK-gen and program-gen by iwahbe · Pull Request #23574 · pulumi/pulumi · GitHub
Skip to content

Implement MultiArgumentInputs for functions in Python SDK-gen and program-gen - #23574

Merged
iwahbe merged 1 commit into
masterfrom
iwahbe/python-multiarg-inputs
Jun 17, 2026
Merged

iwahbe merged 1 commit into
masterfrom
iwahbe/python-multiarg-inputs

Conversation

@iwahbe

@iwahbe iwahbe commented Jun 15, 2026

Copy link
Copy Markdown
Member

Fixes #23549.

Python SDK-gen already emits a positional signature for invokes, spreading each input into its own keyword parameter and packing them into the named property bag on the wire. multiArgumentInputs therefore needs no distinct codegen path in Python — the only thing standing in the way was a hard error guarding functions (and program-gen methods and invokes) that set the flag.

Removing those guards lets the existing generators produce the expected positional invoke for a multiArgumentInputs function:

def multi_argument_invoke(first, second=None, opts=None) -> ...

Python is exercised end-to-end by the l2-invoke-multi-argument conformance test (added in #23570); it is removed from that test's expected failures and its snapshots are generated.

@iwahbe
iwahbe force-pushed the iwahbe/python-multiarg-inputs branch from 79b86b8 to b3e7282 Compare June 15, 2026 19:21
…gram-gen

Fixes #23549.

Python SDK-gen already emits a positional signature for invokes, spreading
each input into its own keyword parameter and packing them into the named
property bag on the wire, so multiArgumentInputs needs no distinct SDK-gen
path: the only thing standing in the way was a hard error guarding functions
that set the flag. Removing it produces the expected signature, ordered by
the schema's multiArgumentInputs list (schema binding sorts the input
properties to match):

    def multi_argument_invoke(first, second=None, opts=None) -> ...

Program-gen now spreads the invoke's input bag into positional arguments in
that same order, with None standing in for omitted optional inputs, reusing
the shared GenerateMultiArguments/SortedFunctionParameters helpers:

    multi_argument_invoke.multi_argument_invoke_output("hello", "world")

Multi-argument methods remain unimplemented (program-gen still errors),
matching the other language backends.

Python is exercised end-to-end by the l2-invoke-multi-argument conformance
test (added in #23570); it is removed from that test's expected failures and
its snapshots are generated.
@iwahbe
iwahbe force-pushed the iwahbe/python-multiarg-inputs branch from b3e7282 to d536d30 Compare June 15, 2026 19:31
@iwahbe
iwahbe marked this pull request as ready for review June 15, 2026 20:02
@iwahbe
iwahbe requested a review from a team as a code owner June 15, 2026 20:02
@iwahbe
iwahbe enabled auto-merge June 16, 2026 00:12
} else {
invokeArgs = expr.Args[1].(*model.ObjectConsExpression)
}
pcl.GenerateMultiArguments(g.Formatter, w, "None", invokeArgs, pcl.SortedFunctionParameters(expr))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This predates this PR, but it's a bit weird that we have this helper that generates a code string used in Node.js, and now Python, in the pcl package. In practice it works of course since it's just a comma separated list 🤷

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we probably should rip that out into a util package for codegen, or just remove it.

@iwahbe
iwahbe added this pull request to the merge queue Jun 17, 2026
@julienp
julienp removed this pull request from the merge queue due to a manual request Jun 17, 2026
@iwahbe
iwahbe added this pull request to the merge queue Jun 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 17, 2026
@iwahbe
iwahbe added this pull request to the merge queue Jun 17, 2026
Merged via the queue into master with commit 7a45b69 Jun 17, 2026
349 of 353 checks passed
@iwahbe
iwahbe deleted the iwahbe/python-multiarg-inputs branch June 17, 2026 22:08
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v3.247.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[python] Implement MultiArgumentInputs for functions in SDK-gen and program-gen

3 participants