prodigyeducation / python-graphql-client

Simple module for making requests to a graphQL server in python.
https://pypi.org/project/python-graphql-client/
MIT License
80 stars 21 forks source link

Add Type Hints #25

Open DaleSeo opened 4 years ago

DaleSeo commented 4 years ago

Is your feature request related to a problem? Please describe.

We recently started using Mypy as a static type checker and realized that this library can cause type errors like below due to missing type hints or library stubs around the API.

app/memberships/repository.py:12:1: error: Skipping analyzing 'python_graphql_client': found module but no type hints or library stubs  [import]
    from python_graphql_client import GraphqlClient
    ^
app/admin.py:9:1: error: Skipping analyzing 'python_graphql_client': found module but no type hints or library stubs  [import]
    from python_graphql_client import GraphqlClient
    ^

Describe the solution you'd like

I think adding type hints to this library would be helpful for Mypy users.

Describe alternatives you've considered

Providing library stubs could also work but considering the amount of code here, I'm afraid that would be overkill.

Additional context

Optionally, this library itself considering not only type hinting but also type checking using Mypy.

xkludge commented 4 years ago

Great idea, just follow the pep guide lines https://www.python.org/dev/peps/pep-0561/ which I think mypy supports.