mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.95k stars 563 forks source link

Add docstrings and more to pyodbc.pyi #1134

Closed keitherskine closed 1 year ago

keitherskine commented 1 year ago

This PR enhances the existing pyodbc.pyi file by:

The docstrings are in Google format, although I should say I haven't stuck rigidly to that guide.

The docstrings I've added don't attempt to provide a full description for every function. The behavior of many functions is complex and I believe the Wiki is still the best place to provide comprehensive documentation. My intention is to enhance the experience for developers by adding more summary info to the popups often seen in PyCharm, VSCode, etc.

I'm aware that List[] and Dict[] can generally be used in their base form (list[] and dict[]) but I stuck with List[] and Dict[] in this PR for consistency. Ditto for Optional and | None.

This PR does make use of the relatively new typing.TypeAlias annotation which is available only in 3.10+ (also typing.Final from 3.8). I don't think this should be an issue because this shouldn't affect running code and linters should probably be using the latest version of Python anyway, but if anybody thinks this is problematic, let me know.

Also, the build is failing for Python 3.6 because Github Action's runner ubuntu-latest was recently upgraded from 20.04 to 22.04, and 22.04 is not available for Python 3.6 in Github Actions. (Another reason for dropping 2.7/3.6.)