← All tasks
pythonimageio/imageio #820Not a task: already works

Strict mypy support for imread

envgap__imageio__imageio-820

01 / FAILURE SIGNATURE

As reported upstream

error: Call to untyped function "imread" in typed context
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
9fd2b3504ee7dd55bb7f717fafdf5ae6fe0a294f
Manifest
setup.py
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

imageio/imageio #820 · read the original issue
When using `imageio.v3.imread`, `mypy` complains that there is no return type, with the following error:



```bash

error: Call to untyped function "imread" in typed context

```



The current work around is to do something like the following:



```python

img:  npt.NDArray[np.float_] = imageio.v3.imread('my_image.png')  # type: ignore[no-untyped-call]

```



Without the `# type: ignore`, `mypy` returns an error.



This is using imageio v2.19.3 and mypy v0.961



To reproduce the issue, with `imageio`, `numpy`, and `mypy` installed:



1. create a file, `test_it.py` with the following:



   ```python

   import imageio

   import numpy as np

   import numpy.typing as npt



   img: npt.NDArray[np.float_] = imageio.v3.imread("my_image.png")

   ```



2. run `mypy` in strict mode:



   ```bash

   $ mypy --strict test_it.py

   ```



3. The test fails, with error described above.











Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]