zarr-python icon indicating copy to clipboard operation
zarr-python copied to clipboard

Declare typing support via `py.typed` file

Open jwodder opened this issue 2 years ago • 3 comments

Running mypy on code that uses the latest version of zarr fails with the error message "module is installed, but missing library stubs or py.typed marker". A quick look at zarr's source indicates that it is using type annotations, but because there is no py.typed file, mypy will not use the annotations when type-checking code that uses zarr.

To resolve this, please do the following:

  • [ ] If not already, ensure that all public items in zarr are type-annotated and validated by mypy.
  • [ ] Add an empty file named py.typed inside the zarr/ package.
  • [ ] Ensure that the zarr/py.typed file is included in sdists & wheels built from the project. This may involve configuration specific to your build backend (setuptools) that is beyond the scope of this comment.
    • You can list the contents of an sdist (the dist/zarr-{version}.tar.gz file created when building the project) by running tar ztf dist/zarr-{version}.tar.gz on it.
    • You can list the contents of a wheel (a dist/zarr-{version}-*-*-*.whl file created when building the project) by running zipinfo -1 dist/zarr-{version}-*-*-*.whl on it.

Further references:

jwodder avatar Nov 07 '23 20:11 jwodder

@jwodder - thanks for opening this issue. It is perfectly aligned with what we're looking to provide in v3.

That said, I think we should wait to do this work until we're a little further along (i.e. https://github.com/zarr-developers/zarr-python/issues/1593 👈 help wanted!).

jhamman avatar Dec 07 '23 20:12 jhamman

@dstansby - wondering if you can take this one on as part of #1783.

jhamman avatar May 07 '24 05:05 jhamman

👍

dstansby avatar May 07 '24 10:05 dstansby