Open Ry-DS opened 2 years ago
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.
Can I ask the obvious question; Is there a reason to still support python 2.7?
Because if there isn't, I'll create a PR with the typehints added right now.
I have a draft PR which adds typehints to primarily jira.py. Mypy identified some issues that I feel need to be addressed above my paygrade.
https://github.com/atlassian-api/atlassian-python-api/pull/1418/files
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+)