atlassian-python-api
atlassian-python-api copied to clipboard
Add typeshed stubs for this project
Would be great if down the line, types are published onto typeshed to help mypy users importing this project.
Or, the mypy config on this project could be changed to --strict
, and collective effort is put into typing the project here (will force the project to only work on Python 3.5+)
Hi @Ry-DS , do you mean in that way ? https://mypy.readthedocs.io/en/latest/stubs.html#stub-file-syntax Could you show some example please?
The easiest way is to go through every file and add the definitions with the files like I did in #1031 (reverted in https://github.com/atlassian-api/atlassian-python-api/pull/1031/commits/e8babc0300b78a0365ad38df2185d4f98da231f0). Then, the types will update with the code as the project evolves. Another route is putting the stub files pyi
in this repo itself, like described in the link you sent. They just have to be in the same location with the same name. I haven't used this myself but mypy should pick them up when the module is installed.
Another option to keep things separate from this repo is to make a PR in https://github.com/python/typeshed. Then users can download stubs with a simple pip command. This does mean you'll need to update this location manually. An example PR: https://github.com/python/typeshed/pull/5789/files
For the last 2 options, a useful tool is https://mypy.readthedocs.io/en/stable/stubgen.html, which can create a basic skeleton. The types can be updated from there.