-
Notifications
You must be signed in to change notification settings - Fork 203
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
Begin type hinting #374
Begin type hinting #374
Conversation
Codecov Report
@@ Coverage Diff @@
## master #374 +/- ##
=========================================
Coverage ? 85.89%
=========================================
Files ? 10
Lines ? 1666
Branches ? 157
=========================================
Hits ? 1431
Misses ? 192
Partials ? 43
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hi, thanks a lot for these contributions so far. Should we see this PR as WIP and wait to review it until you indicate you're finished? BTW, I don't understand how your latest commit with the modern typing syntax (e.g., |
Hi yes best to see it as WIP. I changed it to draft status. I'm working on typing the client now and as I go I sometime go back and tweak those two file. I'll let you know when I'm confident enough to send it for review. The changes work because of the |
I'm quite confident the type are correct now but worst case scenario we can tweak them in future PR. Ready for review |
@enadeau wow - you are contributing to much to this package!! would you mind adding 2 entries to our changelog that includes this PR and the other just merged? it would look something like this:
If there is no related issue you can simply just list the pr number :) we just want to ensure you get credit for these awesome contributions!! |
ignore the above. i needed to update pydantic to 1.9+ |
"pydantic.mypy" | ||
] | ||
|
||
files = [ |
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.
this is great that we can limit what mypy looks at. what i wasn't sure about is whether our pre-commit.ci bot will follow this configuration (it might). it seems to want to run on all files which is what i was worried about with CI. We could test that on this PR if you wish to add the config to the pre-commit.config.yaml file.
I'm very happy to contribute 😄 I've updated the changelog. About mypy, I've added a workflow to run it instead of putting it in pre-commit. Because pre-commit is designed to run on diff file and mypy really want to analyze the whole program, it is generally not recommended to have mypy as a pre-commit hook. All repos I've worked with run it as an action. Let me know what you think |
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.
LGTM
nice work, thanks a lot.
@enadeau many thanks for this!
I think that you know a lot more about implementing mypy that I do! Thus, I fully trust your evaluation and suggestion that we add it as a ci build. I am sorry i pushed back against that earlier!! I should have asked you about things like - specifying specific files for it to run on as we get other pr's! |
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.
I think we can approve this PR. i have requested just a tiny change to the name of the type checking file just so it's clear what that action does. but i'm approving this PR as it is a great addition to this package. @jsamoocha would love to get your input before merging in case i'm missing something!!
I changed the name and for what I'm concerned it is ready to go. Not quite sure what's up with the documentation build. Seems to complain a lot about |
oh that is an unusual error. Let me dig into it. |
I reran the job and it built just fine. That warning is still popping up 🤷♀️ . I think we can merge this PR without worrying about it because i suspect it's a theme issue not a stravalib issue. It's certainly not related to anything that you have implemented in this pr!! i'll keep an eye on the docs build for future pr's. We can open an issue if it pops up again OR if we find the readthedocs is not building as it should. also many thanks for modifying that file name! |
We have two approvals here and all checks are passing so i'll go ahead and merge!! 🚀 |
Thanks again @enadeau, adding mypy to CI is a great addition to improve our code quality. Awesome contribution! |
Description
Introduce type annotation and static type checking as discussed in #373
This include some trivial changes to some function.
The only change that I can see breaking something for user is the removal of the function
total_seconds
from the limiter file that seems to be some workaround forpython pre 2.7.
Type of change
Select the statement best describes this pull request.
Does your PR include tests
If you are fixing a bug or adding a feature, we appreciate (but do not require)
tests to support whatever fix of feature you're implementing.
Did you include your contribution to the change log?
changelog.md
is up-to-date.