-
Notifications
You must be signed in to change notification settings - Fork 218
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 Python linting and reformatting #26
Conversation
I chose the same `pyproject.toml` configuration as the `sherlockml` library, for consistency.
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 looks good @pbugnion!
I made a couple of comments about getting black
and flake8
to work together nicely. Let me know what you think.
Black and Flake8 diverge on what PEP 8 compliance means. This is detailed in the Black readme: https://github.com/ambv/black To allow the two to work together, we have to silence some Flake8 errors.
9adb044
to
75b07eb
Compare
I've fixed the flake8 incompatibilities. |
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'm happy with this if you are @pbugnion
Add Python linting and reformatting
This PR adds flake8 and black to the build pipeline. Black enforces a consistent code style, and flake8 catches common errors like unused imports or unused variables.
I have used the same black configuration as sherlockml for consistency across ASI.
The only complexity is that flake8 needs to ignore specific components files in the documentation: the ones that require
app
to be injected when the code is executed. For now, this is justcollapse
.This also adds a very basic check for syntax errors in the source code for all the versions of Python which I presume we want to target. Since Dash supports Python 2, the cost to supporting it seems minimal.