civisanalytics / civis-python

Civis API Python Client
BSD 3-Clause "New" or "Revised" License
34 stars 26 forks source link

[CIVIS-8439] ENH add stub file for API endpoints #479

Closed jacksonlee-civis closed 4 months ago

jacksonlee-civis commented 4 months ago

The API endpoints are auto-generated attributes attached to a civis.APIClient instance. Since dynamically generated objects don’t play nice with static type checkers (such as those embedded in an IDE as well as tools like mypy), writing code to hit the Civis API via a civis.APIClient instance has been somewhat prone to errors due to the lack of IDE support. This pull request adds a stub file src/civis/client.pyi for the API endpoints as attributes attached to civis.APIClient, so that our IDE can now help us catch potential coding errors -- see the screen captures below for PyCharm and VS Code.

Related changes:


PyCharm:

pycharm

VS Code:

vscode