Is your feature request related to a problem? Please describe.
Using csp.output to return named outputs from a node does not support dict unpacking when passing arguments. We fail when parsing the AST.
Example repro:
import csp
from datetime import datetime, timedelta
@csp.node
def reproduce(trigger: csp.ts[bool]) -> csp.Outputs(
a=csp.ts[int],
b=csp.ts[int],
):
if csp.ticked(trigger):
values = {"a": 1, "b": 2}
csp.output(**values)
# This explicit equivalent parses successfully:
# csp.output(a=1, b=2)
@csp.graph
def graph():
result = reproduce(csp.const(True))
csp.print("a", result.a)
csp.print("b", result.b)
if __name__ == "__main__":
csp.run(
graph,
starttime=datetime(2026, 1, 1),
endtime=timedelta(seconds=1),
)
fails with
File "/tmp/csp_output_kwargs_github_repro.py", line 11, in <module>
csp.output(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^
csp.impl.wiring.base_parser.CspParseError: unrecognized output 'None'
Describe the solution you'd like
It would be nice if we supported standard dict unpacking in the AST logic as it can often simplify nodes with many return values (no need to write explicitly every field). For example:
csp.output(**{f: values[f] for f in FIELDS})
vs
csp.output(
field1=values['field1'],
...,
fieldN=values['fieldN'],
Describe alternatives you've considered
We could also just support parsing the dict as an allowable return value as well i.e. csp.output(values) where values is a dict. This is currently unsupported as well, fails with
File "/tmp/csp_output_kwargs_github_repro.py", line 11, in <module>
csp.output(values)
^^^^^^^^^^^^^^^^^^^^^^^
csp.impl.wiring.base_parser.CspParseError: cannot csp.output single unnamed arg in node returning 2 outputs
Additional context
n/a
Is your feature request related to a problem? Please describe.
Using
csp.outputto return named outputs from a node does not support dict unpacking when passing arguments. We fail when parsing the AST.Example repro:
fails with
Describe the solution you'd like
It would be nice if we supported standard dict unpacking in the AST logic as it can often simplify nodes with many return values (no need to write explicitly every field). For example:
csp.output(**{f: values[f] for f in FIELDS})vs
Describe alternatives you've considered
We could also just support parsing the dict as an allowable return value as well i.e.
csp.output(values)where values is a dict. This is currently unsupported as well, fails withAdditional context
n/a