-
Notifications
You must be signed in to change notification settings - Fork 27
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 code hygiene for python #660
Conversation
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #660 +/- ##
=========================================
+ Coverage 0 91.51% +91.51%
=========================================
Files 0 25 +25
Lines 0 1155 +1155
Branches 0 122 +122
=========================================
+ Hits 0 1057 +1057
- Misses 0 83 +83
- Partials 0 15 +15 ☔ View full report in Codecov by Sentry. |
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.
What do folks think?
strategy: | ||
fail-fast: false | ||
matrix: | ||
location: |
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 like we might have some dead code, should we delete some of these?
- run: python3 -m pip install -r dev-requirements.txt | ||
continue-on-error: true # Not all projects have dev-requirements.txt, safe to ignore | ||
- run: python3 -m pip install -r requirements.txt | ||
continue-on-error: true # Not all projects have requirements.txt, safe to ignore |
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.
Maybe replace these with a pipenv file?
- id: mypy | ||
continue-on-error: true # Success/failure checked in last job step | ||
run: python3 -m mypy . |
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 looked into mypy a bit and think I'm in favor of trying it out. I'd love to take a gradual approach here if possible. Maybe you have thoughts on the topic, but what about the following high level approach
- Add mypy to the repo's Python packages
- Make it easy to run mypy and other style checks locally before submitting your PR
- Update READMEs as appropriate to document how to run the checks locally
- Configure mypy to:
- Error if a type annotation exists, but is wrong
- Warn if a type annotation is missing, but not count it as a failure
- Ignore missing type annotations from third-party, imported Python modules
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.
Assuming all of the projects that I'm running this job over are code we care about - I'll fix all the errors to get us into a passing state before merging. How we handle different errors, such as missing type annotations can be done on a case-by-case basis.
Update READMEs as appropriate to document how to run the checks locally
For which README(s) should be updated, do we do this at the project level or individual project level?
Since its been a while since I've put attention on this PR I'm going to close it out; if/when I get time I'll reopen this. |
Description
Add code hygiene checks for python, broken apart by the different projects within the repo.
Testing
New GitHub action is triggered on any changes via a pull request or push to the repository.
Check List
All tests pass, including unit test, integration test and doctestBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.