New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add static type annotations #11047
Comments
We are aware of the issue but there is currently no plan on addressing this from within the currently active contributors. We currently have other (higher) priorities to focus our effort on. Contributions are welcome though if you are interested in helping out. |
We've been adding type annotations continuously over the past 1-2 years but the code base is very large and ensuring that everything is typed is very difficult. This is rather an incremental process. As was already mentioned, contributions are welcome and I guess this is a comparatively easy topic for a first couple of contributions. We're using mypy for type checking and the modules that are already fully typed are listed here (not many yet) Lines 180 to 184 in b2ec1e1
FWIW we're already much further along for dask/distributed https://github.com/dask/distributed/blob/66ced13b33aeafe0d684b4424364c69f0b5a0d43/pyproject.toml#L201-L212 |
@sam-goodwin (or anyone else having issues with type hinting) - are there any specific functions causing problems for you aside from |
Hi @benrutter, I agree that we don't need to take on the whole repo and there is plenty of low hanging fruit. The errors I am running into are:
da.from_zarr(core.core_img).map_blocks(
segment_tissue,
dtype=np.uint8,
drop_axis=0,
downsample_factor=tissue_masks_params.downsample_factor,
) Error:
If you add explicit
Perhaps something wacky with @wraps(map_blocks)
def map_blocks(self, func, *args, **kwargs):
return map_blocks(func, self, *args, **kwargs)
map_blocks: _Wrapped[(func: Unknown, *args: Unknown, name: Unknown | None = None, token: Unknown | None = None, dtype: Unknown | None = None, chunks: Unknown | None = None, drop_axis: Unknown | None = None, new_axis: Unknown | None = None, enforce_ndim: bool = False, meta: Unknown | None = None, **kwargs: Unknown), Unknown, (self: Array, func: Unknown, *args: Unknown, **kwargs: Unknown), Unknown] | Any |
I am having trouble with using Dask in a project that uses PyRight because Dask does not use static type annotations/
Take,
da.from_array
, for example:dask/dask/array/core.py
Lines 3307 to 3317 in b2ec1e1
Or
array.rechunk
:dask/dask/array/rechunk.py
Lines 268 to 275 in b2ec1e1
PyRight complains if you use anything but a
str
forchunks
:This happens because in
from_array
andrechunk
,chunks="auto"
infers to astr
type.Is there an awareness of this problem? Is there a known solution? If not, is there a plan to fix this?
The text was updated successfully, but these errors were encountered: