Skip to content

Distribute type hints (PEP 561) #533

Closed
@pcorpet

Description

@pcorpet
  • Algolia Client Version: 2.5.0
  • Language Version: 3.9

Description

The library's code contains type hints (great!) but those are not advertised so our code doesn't use them (it doesn't even look for them). According to PEP 561, you would need to package and distribute a py.typed file with your library for those types to be used easily.

Steps To Reproduce

Write some python code based on algoliasearch.

In requirements.txt:

algoliasearch==2.5.0
mypy==0.910

In the code:

from algoliasearch import search_client

search_client.SearchClient.create(
    os.getenv('ALGOLIA_APP_ID', ''),
    os.getenv('ALGOLIA_API_KEY', '')).init_index(3)

Running mypy doesn't yell, where it should actually fail with the following error:

error: Argument 1 to "init_index" of "SearchClient" has incompatible type "int"; expected "str"

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