TypeError: Type hint must be an 'Annotated' type.
See original GitHub issueHello,
I’m trying to run a simple example like:
from napari.layers import Image
import numpy as np
@magicgui
def my_widget(ny: int=64, nx: int=64) -> Image:
return Image(np.random.rand(ny, nx), name='my Image')
And I get this error always. Also with others examples.
TypeError: Type hint must be an 'Annotated' type.
Maybe I’m missing something. Sorry if the question is too basic, I’m new on this.
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
typing — Support for type hints — Python 3.11.1 documentation
The Python runtime does not enforce function and variable type annotations. They can be used by third party tools such as type checkers,...
Read more >Type hints cheat sheet - mypy 0.991 documentation
Type hints cheat sheet#. This document is a quick cheat sheet showing how to use type annotations for various common types in Python....
Read more >Why PyPy fails when I try to define type annotated class ...
Using list[str] with a __future__ import breaks typing.get_type_hints , though. Pretty much anything that wants to access the type at runtime ...
Read more >Understanding type annotation in Python - LogRocket Blog
With type hints, you can annotate variables and functions with datatypes. Tools like mypy, pyright, pytypes, or pyre perform the functions of ...
Read more >25.1. typing — Support for type hints — Python 3.6.1 ...
This module supports type hints as specified by PEP 484 and PEP 526. The most fundamental support consists of the types Any ,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Interesting… Thanks for the environment and traceback! I’ll try to dig a little deeper to see what might have caused it
Not sure how but now it is working. I had some issues with Ipywidgets, so installed them again and now…it works.