Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distribute type hints (PEP 561) #533

Closed
pcorpet opened this issue Aug 6, 2021 · 1 comment · May be fixed by #566
Closed

Distribute type hints (PEP 561) #533

pcorpet opened this issue Aug 6, 2021 · 1 comment · May be fixed by #566

Comments

@pcorpet
Copy link

pcorpet commented Aug 6, 2021

  • 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"
@shortcuts
Copy link
Member

Hey there, this should have been fixed in v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants