Repository: pulumi/pulumi
Issue: Python Lint failing on CI, blocking merges

Jobs have begun failing with errors in linting the Python SDK, specifically failing on running `mypy`: https://github.com/pulumi/pulumi/actions/runs/3624968763/jobs/6112540141

Logs:

```
. venv/*/activate && \\
	MYPYPATH=./stubs python -m mypy ./lib/pulumi --config-file=mypy.ini
lib/pulumi/runtime/invoke.py:[19](https://github.com/pulumi/pulumi/actions/runs/3624968763/jobs/6112540141#step:16:22)0: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/pulumi/runtime/invoke.py:236: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/pulumi/runtime/invoke.py:251: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/pulumi/runtime/rpc.py:5[21](https://github.com/pulumi/pulumi/actions/runs/3624968763/jobs/6112540141#step:16:24): error: Argument 1 to "FileAsset" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "Union[str, PathLike[Any]]"  [arg-type]
lib/pulumi/runtime/rpc.py:5[23](https://github.com/pulumi/pulumi/actions/runs/3624968763/jobs/6112540141#step:16:26): error: Argument 1 to "StringAsset" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:5[25](https://github.com/pulumi/pulumi/actions/runs/3624968763/jobs/6112540141#step:16:28): error: Argument 1 to "RemoteAsset" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:534: error: Argument 1 to "FileArchive" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:536: error: Argument 1 to "RemoteArchive" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:577: error: Argument 1 to "_parse_urn" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:586: error: Argument 2 to "get_resource_package" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:589: error: Argument 3 to "construct_provider" of "ResourcePackage" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:592: error: Argument 3 to "get_resource_module" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:594: error: Argument 3 to "construct" of "ResourceModule" has incompatible type "Union[Struct, ListValue, str, float, bool, None]"; expected "str"  [arg-type]
lib/pulumi/runtime/rpc.py:601: error: Incompatible return value type (got "Union[Struct, ListValue, str, float, bool, None]", expected "Resource")  [return-value]
```

Changed files:
sdk/python/lib/pulumi/runtime/rpc.py

diff --git a/sdk/python/lib/pulumi/runtime/rpc.py b/sdk/python/lib/pulumi/runtime/rpc.py
index da9515e37..1bbce62c7 100644
--- a/sdk/python/lib/pulumi/runtime/rpc.py
+++ b/sdk/python/lib/pulumi/runtime/rpc.py
@@ -29,6 +29,7 @@ from typing import (
     Optional,
     Sequence,
     Set,
+    Union,
     TYPE_CHECKING,
     cast,
 )
@@ -45,7 +46,7 @@ from .. import urn as urn_util
 
 if TYPE_CHECKING:
     from ..output import Inputs, Input, Output
-    from ..resource import CustomResource, Resource, ProviderResource
+    from ..resource import Resource, CustomResource, ProviderResource
     from ..asset import (
         FileAsset,
         RemoteAsset,
@@ -518,11 +519,11 @@ def deserialize_properties(
         if props_struct[_special_sig_key] == _special_asset_sig:
             # This is an asset. Re-hydrate this object into an Asset.
             if "path" in props_struct:
-                return FileAsset(props_struct["path"])
+                return FileAsset(str(props_struct["path"]))
             if "text" in props_struct:
-                return StringAsset(props_struct["text"])
+                return StringAsset(str(props_struct["text"]))
             if "uri" in props_struct:
-                return RemoteAsset(props_struct["uri"])
+                return RemoteAsset(str(props_struct["uri"]))
             raise AssertionError(
                 "Invalid asset encountered when unmarshalling resource property"
             )
@@ -531,9 +532,9 @@ def deserialize_properties(
             if "assets" in props_struct:
                 return AssetArchive(deserialize_property(props_struct["assets"]))
             if "path" in props_struct:
-                return FileArchive(props_struct["path"])
+                return FileArchive(str(props_struct["path"]))
             if "uri" in props_struct:
-                return RemoteArchive(props_struct["uri"])
+                return RemoteArchive(str(props_struct["uri"]))
             raise AssertionError(
                 "Invalid archive encountered when unmarshalling resource property"
             )
@@ -570,9 +571,11 @@ def deserialize_properties(
 
 def deserialize_resource(
     ref_struct: struct_pb2.Struct, keep_unknowns: Optional[bool] = None
-) -> "Resource":
-    urn = ref_struct["urn"]
-    version = ref_struct["packageVersion"] if "packageVersion" in ref_struct else ""
+) -> Union["Resource", str]:
+    urn = str(ref_struct["urn"])
+    version = (
+        str(ref_struct["packageVersion"]) if "packageVersion" in ref_struct else ""
+    )
 
     urn_parts = urn_util._parse_urn(urn)
     urn_name = urn_parts.urn_name