Skip to content

Make openml-python PEP 561 compliant - Distributing and Packaging Type Information #945

@eddiebergman

Description

@eddiebergman

Description

I'm building my own python library that uses openml and I'm converting it to be statically typed. I see that the actual library has type hints but it's not recognized by mypy.

mypy : Skipping analyzing 'openml': found module but no type hints or library stubs

When reading mypy's docs they give quick instructions on how to do this with PEP 561 described here.

In summary it is to:

  • add a blank file called py.typed to the packaged directory
  • add the string "py.typed" to package_data in setup.py

I think this would be a nice extra compliance feature for the library to have moving forward and can allow any other integrations or allow anyone else building a library with openml to use their types.

Steps/Code to Reproduce

> mypy -c 'import openml'      
  
<string>:1: error: Skipping analyzing 'openml': found module but no type hints or library stubs
<string>:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

Expected Results

> mypy -c 'import openml'

Success: no issues found in 1 source file

Versions

Linux-5.8.10-arch1-1-x86_64-with-glibc2.2.5
Python 3.8.5 (default, Sep 21 2020, 12:33:30)
[GCC 10.2.0]
NumPy 1.19.2
SciPy 1.5.2
Scikit-Learn 0.23.2
OpenML 0.10.2
mypy 0.782

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions