-
Notifications
You must be signed in to change notification settings - Fork 76
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 and mypy compliance #225
Add type annotations and mypy compliance #225
Conversation
+ improved call signature stubs for base provider class Many errors are skipped due to present limitations, esp Liskov issues See CenterForOpenScience#225 [#SVCS-340] [ci skip]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, @abought! One minor nitpick per our poorly-advertised CONTRIBUTING.md.
import json | ||
import os | ||
import typing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Per our CONTRIBUTING.md, imports should be split into three groups (core, external, internal) and each group ordered by line length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 3705f2a
I haven't yet manually tested this; is there a page with suggestions on common operations to verify?
Some tests are passing locally but failing on travis; still investigating why. In particular, as part of the cleanup of abc stub classes, I added async
keyword to a few methods of the base class (when all child classes were using it). Want to make sure this doesn't cause unintended side effects.
233979d
to
55ed70c
Compare
[ci skip] [#SVCS-340]
then start on abstract implementation [#SVCS-340] [ci skip]
[#SVCS-340] [ci skip]
[#SVCS-340] [ci skip]
[#SVCS-340] [ci skip]
[#SVCS-340] [ci skip]
+ improved call signature stubs for base provider class Many errors are skipped due to present limitations, esp Liskov issues See CenterForOpenScience#225 [#SVCS-340] [ci skip]
[#SVCS-340] [ci skip]
Add type annotations to metadata and path objects [#SVCS-351]
[#SVCS-351] [ci skip]
a set of conventions (sometimes arbitrary) about how to write code for that project." [#SVCS-351]
3705f2a
to
a824ab9
Compare
Initial manual testing ok. Merge conflicts with googledrive refactor; I will update and revalidate before next week. |
…erbutler into feature/svcs340-waterbutlerpath
b980aa3
to
e3fc183
Compare
Merge conflicts resolved and basic retesting done. Let me know if there are additional checks requested! |
🦑 Ready for review, but watch for sea monsters (my first WB PR)
Ticket
https://openscience.atlassian.net/browse/SVCS-351
Purpose
Notes for reviewers
To try this out, run
inv mypy
.In the future this can be used in Travis CI, but is currently hidden behind a flag by default:
inv test --types
Many of these types are a "best guess" and subject to evolve in the future. Python types are informational only and do not affect runtime, but tools such as mypy (and pycharm!) support automatic linting to catch errors during development.
I am new to waterbutler. If there is a better type to use, let me know. The ignore settings in mypy may be too aggressive and are worth revisiting in the future.
Specific rules that we ignore
Mypy does not appear to support selective ignoring of certain rules. Therefore, ignore statements are scattered throughout the code more than I would wish. See notes and rationale:
https://github.com/python/mypy/issues/1693
@overload
, if we some day refactor so that files and folders are represented via different classes.https://github.com/python/mypy/issues/1237
Summary of changes
Testing notes
In theory this is a pure developer facing change. One or two minor changes were made to method call signatures.
Recommend watching for any new errors during common operations. I have done light manual testing consisting of uploads/downloads/renames/cross provider moves (osf storage to google drive).