Skip to content

Declare typing support via py.typed file #1566

Closed
@jwodder

Description

@jwodder

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedIssue could use help from someone with familiarity on the topictypes

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions