Skip to content
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

Fix overloads for all and from_input to not return Never types #16139

Merged
merged 1 commit into from
May 7, 2024

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented May 7, 2024

Description

Fixes #16027.

Seems mypy was having issues with Outputs being passed into these methods and tracking that they should have just been returning the same Output in the result. Adding these extra overloads seems to have appeased the type checker when using these methods.

Checklist

  • I have run make tidy to update any new dependencies
  • I have run make lint to verify my code passes the lint check
    • I have formatted my code using gofumpt
  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version

@Frassle Frassle marked this pull request as ready for review May 7, 2024 13:30
@Frassle Frassle requested a review from a team as a code owner May 7, 2024 13:30
@pulumi-bot
Copy link
Contributor

Changelog

[uncommitted] (2024-05-07)


@overload
@staticmethod
def from_input(val: Input[T_co]) -> "Output[T_co]": ...
Copy link
Contributor

Choose a reason for hiding this comment

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

This signature is exactly the same as the one of implementation below, is it needed?

Copy link
Member Author

@Frassle Frassle May 7, 2024

Choose a reason for hiding this comment

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

mypy docs say it is, that you should list all the overloads with the annotation then have the implementation without @overload.

Fixes #16027.

Seems mypy was having issues with Outputs being passed into these methods and
tracking that they should have just been returning the same Output in the
result. Adding these extra overloads seems to have appeased the type checker
when using these methods.
@Frassle Frassle added this pull request to the merge queue May 7, 2024
Merged via the queue into master with commit cffdfd1 May 7, 2024
49 checks passed
@Frassle Frassle deleted the fraser/mypyAllFrom branch May 7, 2024 15:18
github-merge-queue bot pushed a commit that referenced this pull request May 10, 2024
Tentative changelog:

### Bug Fixes

- [engine] Fix dataraces between snapshot and deployment systems.
  [#16148](#16148)

- [cli/display] Fix mangled diffs of strings containing url-encoded
chars
  [#16147](#16147)

- [sdk/nodejs] Don't load punycode module in function serialization code
  [#16149](#16149)

- [sdk/python] Fix typings for `from_input` and `all` to not return
`Never` types.
  [#16139](#16139)

- [sdk/python] Fix a race condition in output handling
  [#16155](#16155)
@justinvp justinvp mentioned this pull request May 10, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 13, 2024
Tentative changelog:

### Bug Fixes

- [engine] Fix dataraces between snapshot and deployment systems.
  [#16148](#16148)

- [cli/display] Fix mangled diffs of strings containing url-encoded
chars
  [#16147](#16147)

- [sdk/nodejs] Don't load punycode module in function serialization code
  [#16149](#16149)

- [sdk/nodejs] Return error in RPC response instead of exiting in the
language runtime
  [#16162](#16162)

- [sdk/nodejs] Return the underlying error if we can't locate the pulumi
SDK
  [#16160](#16160)

- [sdk/python] Provide more descriptive exception
  [#16098](#16098)

- [sdk/python] Fix typings for `from_input` and `all` to not return
`Never` types.
  [#16139](#16139)

- [sdk/python] Fix a race condition in output handling
  [#16155](#16155)


### Miscellaneous

- [pkg] Upgrade pulumi-java to v0.11.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.

After Pulumi 3.113.0 we started getting Never's for pulumi applied outputs in mypy
4 participants