Skip to content

Output.all with multiple types throws mypy error about needing an object #16194

Closed
@rshade

Description

@rshade

What happened?

Upgrading to pulumi-3.116.0 throws an error when running mypy when you use different types in Output.all:

__main__.py:18: error: Argument 1 to "return_text" has incompatible type "object"; expected "str"  [arg-type]
__main__.py:18: error: Argument 2 to "return_text" has incompatible type "object"; expected "str"  [arg-type]
__main__.py:18: error: Argument 3 to "return_text" has incompatible type "object"; expected "bool"  [arg-type]

Example

"""A Python Pulumi program"""

from typing import Optional
import pulumi
from pulumi import Output, Input

a: Input[str] = "Hello"
b: Input[str] = "World"
c: Optional[Input[bool]] = True


def return_text(first: str, second: str, third: bool) -> str:
    return f"{first} {second} is {third}"


text = Output.all(
    Output.from_input(a), Output.from_input(b), Output.from_input(c or False)
).apply(lambda x: return_text(x[0], x[1], x[2]))


print(text)```

### Output of `pulumi about`

CLI
Version 3.116.0
Go Version go1.22.2
Go Compiler gc

Plugins
KIND NAME VERSION
language python unknown

Host
OS ubuntu
Version 20.04
Arch x86_64

This project is written in python: executable='venv/bin/python3' version='3.11.9'

Dependencies:
NAME VERSION
mypy 1.10.0
pip 24.0
pulumi 3.116.0
pyright 1.1.362


### Additional context

_No response_

### Contributing

Vote on this issue by adding a 👍 reaction. 
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already). 

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions