sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[Feature Request] Make start_update/execute_update work with vscode/pyright and add pyright to CI

Open cretz opened this issue 2 years ago • 3 comments

Describe the solution you'd like

Right now vscode/pylance/pyright fails with: image

I think we probably just need to remove the typing for multi-param update (use Sequence[Any] like signal/query). Then we need to add https://github.com/microsoft/pyright to CI alongside MyPy if it's not too difficult.

cretz avatar Nov 09 '23 14:11 cretz

Also note that the return type for execute_update and similar is not properly inferred from the method in Pyright like it is in MyPy

cretz avatar Nov 09 '23 15:11 cretz

Another example:

samples-python(main) .venv/bin/pyright --pythonpath .venv/bin/python hello/hello_activity.py
/Users/dan/src/temporalio/samples-python/hello/hello_activity.py
  /Users/dan/src/temporalio/samples-python/hello/hello_activity.py:58:24 - error: No overloads for "execute_workflow" match the provided arguments (reportCallIssue)
  /Users/dan/src/temporalio/samples-python/hello/hello_activity.py:59:13 - error: Argument of type "(self: GreetingWorkflow, name: str) -> Coroutine[Any, Any, str]" cannot be assigned to parameter "workflow" of type "str" in function "execute_workflow"
    "function" is incompatible with "str" (reportArgumentType)
2 errors, 0 warnings, 0 informations
samples-python(main) .venv/bin/pyright --version
pyright 1.1.350
samples-python(main) .venv/bin/python --version
Python 3.10.13

dandavison avatar Feb 12 '24 20:02 dandavison

So #471 probably fixed this error, but leaving this open because we still want pyright in CI

cretz avatar Feb 13 '24 22:02 cretz