pypistats icon indicating copy to clipboard operation
pypistats copied to clipboard

Declare typing support via `py.typed` file

Open jwodder opened this issue 1 year ago • 1 comments
trafficstars

Running mypy on code that uses the latest version of pypistats fails with the error message "module is installed, but missing library stubs or py.typed marker". A quick look at pypistats'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 pypistats.

To resolve this, please do the following:

  • [ ] If not already, ensure that all public items in pypistats are type-annotated and validated by mypy.
  • [ ] Add an empty file named py.typed inside src/pypistats/.
  • [ ] Ensure that the pypistats/py.typed file is included in sdists & wheels built from the project. This may involve configuration specific to your build backend (hatch) that is beyond the scope of this comment.

Further references:

jwodder avatar May 01 '24 14:05 jwodder

Thanks for the suggestion!

I've made a start on it in https://github.com/hugovk/pypistats/pull/434, but likely won't be able to continue this month due to PyCon US and other travel.

Please feel free to take the branch and finish it off :)

hugovk avatar May 02 '24 06:05 hugovk