-
-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add type annotations #740
Add type annotations #740
Conversation
Codecov Report
@@ Coverage Diff @@
## master #740 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 9 9
Lines 1678 1678
Branches 283 283
=====================================
Hits 1678 1678 Continue to review full report at Codecov.
|
Hi @isac322, thanks for putting in the time and effort to work on this. Adding type annotations to Arrow has been on my mind for a while. That said, I have a couple of comments: I worry that adding the interface ( That begs the question: should we wait until Arrow drops Python 2 support before adding the Python 3.5+ style type annotations, especially considering that Python 2 is approaching EOL in a few weeks (#739). Or should we go ahead with the commenting approach to maintain backward compatibility with Python 2. I do agree though that adding type annotations is a great step for Arrow and will help reduce future bugs. Once again, thanks for the solid work, I just wanted to start a discussion about the changes. |
Hi @isac322, just wanted to check in on this PR. @systemcatch and I discussed these changes and we decided that it is best to integrate type annotations once Arrow has officially dropped support for Python 2.7 since this will allow us to include more maintainable, inline type annotations. Since Python 2.7 reached EOL today, we plan on dropping Python 2 support from Arrow in a future v0.16.0 release. We would love to integrate inline type annotations for that release and we were wondering if you would be able to help with that. Let us know! Thanks! |
Hi @jadchaar, first of all, I'm sorry for the delay and thank you for the discussion. Because my company still uses Python 2 and 3 both, personally, it would be good if type annotation stored in separate files 😅. |
Let's close this for now and once python 2 support is dropped we can move towards inline type checking. |
Pull Request Checklist
tox
ormake test
to find out!).master
branch.Description of Changes
Added type annotations to all non test codes.
Used python stub file format to annotate for compatibility with Python 2.
mypy -p arrow -2 --strict
andmypy -p arrow --strict
both returnsSuccess: no issues found in 10 source files
(mypy: 0.750)Did not test with
pyre
andpytype
because they both can not handle python 3.8 code.