Skip to content

WIP: Stub files with type hints

As discussed in #10 (comment 167263111):

Added type hints in .pyi stubs files, including type hints for all private (_) functions and methods.

Note that running mypy importlib_metadata will actually not type check the code base, because for Mypy the stub files overwrite the source code so that it doesn't even see the source and thus can't type check it. Instead, Mypy will only check that there are no errors in the .pyi files.

The Retype project supports merging stub files and source code files, so that Mypy can do the internal type checking as well. I will investigate how to set up Retype with the tox -e qa

This merge request will include the following work:

  • Add .pyi stubs files with type hints
  • Add script for running Retype and Mypy to type check importlib_metadata
  • Fix errors in type hints
Edited by Jason R. Coombs

Merge request reports