We’ve had a look and this is the result of a skulpt update where function annotations that were previously ignored, now do something on the client.
try:
from typing import Any, Dict
except:
pass
def foo(x: Dict[Any]) -> None:
pass
# Dict is not defined
# previously no error because the annotation was ignored by the compiler
The suggested fix related to this post with the following adjustments:
try:
from typing import Any, Dict # works on the server
except ImportError:
from .fake_typing import Any, Dict # works on the client side
# fake_typing module
class GenericAlias:
def __getitem__(self, key):
return self
Any = GenericAlias()
Dict = GenericAlias()
What happens to the annotations now?
def foo(x:str) -> None:
pass
print(foo.__annotations__)
# {'x': str, 'return': None}