-
Notifications
You must be signed in to change notification settings - Fork 699
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
Introduce flake8-print as pre-commit hook with migration of print to logger #11994
Introduce flake8-print as pre-commit hook with migration of print to logger #11994
Conversation
Build Artifacts
|
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.
We also specify the flake8 version in our dev requirements, so would be good to add the flake8-print plugin there too: https://github.com/learningequality/kolibri/blob/develop/requirements/dev.txt#L3
@@ -6,6 +6,7 @@ | |||
import tempfile | |||
import time | |||
import zipfile | |||
from builtins import FileNotFoundError |
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 have good news - we no longer support Python 2.7 on develop, so we don't need to do this.
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.
Got it! I was wondering why its giving me error. Turns out i was in py2.7 venv 😆
.pre-commit-config.yaml
Outdated
@@ -5,6 +5,9 @@ repos: | |||
hooks: | |||
- id: trailing-whitespace | |||
- id: flake8 | |||
additional_dependencies: [ | |||
'flake8-print==3.1.4' |
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.
We should be able to use flake8-print==5.0.0, as we are no longer supporting Python 2.7 on develop!
Note that with version 5, they changed the codes to T2* not T0*.
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.
yesss, sure
Thank you, this all looks good to me! |
Summary
flake8-print:3.1.4
which is back-compatible with py2.7print
withlogger
References
Fixes #11990
Reviewer guidance
I was getting
packages/kolibri-tools/lib/i18n/crowdin.py:158:12: F821 undefined name 'FileNotFoundError'
, so i imported it from builtinsWasn't sure about https://github.com/learningequality/kolibri/blob/develop/kolibri/core/logger/utils/user_data.py#L50 so used noqa. I know logger can be used here, but was not sure to remove print or not
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)