-
Notifications
You must be signed in to change notification settings - Fork 11
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
black, prune & precommits #234
Conversation
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.
Thanks for the PR, I just have a few minor comments.
I also think it would be good to add a tutorial somewhere (readme.md) for contributors to install black and a pre-commit hook
@@ -33,8 +33,7 @@ def _add_insee_dep_region(df): | |||
) | |||
df = df.merge(dep, on="insee_reg", how="left") | |||
|
|||
except Exception as e: | |||
# print(e) | |||
except Exception: | |||
pass |
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.
should this be logged?
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 don't think so, the other exceptions in the same file are already silenced... What do you think?
I've just added pre-commits and a mention in the CONTRIBUTING.md. Please double-check this is working as expected, I'm in uncharted waters here 😉 ! |
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.
almost good, config is missing from the yaml file and I proposed a couple of changes to the contribution file.
.flake8
Outdated
count = True | ||
exclude = .git,__pycache__,docs/*,*.yaml,*.zip,.env,*.svg,*.md,*.qmd,*.css,*.txt,*.rst,Dockerfile,.spyproject,.pytest_cache,*.lock,*.toml | ||
max-complexity = 10 | ||
max-line-length = 127 |
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.
do we want 127? I don't remember whether we discussed this already?
cc @hadrilec
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.
That's from the existing CI :
pynsee/.github/workflows/pkgTests.yml
Lines 28 to 33 in 9dc111f
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --ignore=E722,C901 --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
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.
OK, let's discuss it on Friday, then!
Co-authored-by: tfardet <79037344+tfardet@users.noreply.github.com>
Co-authored-by: tfardet <79037344+tfardet@users.noreply.github.com>
Co-authored-by: tfardet <79037344+tfardet@users.noreply.github.com>
TODO : update CI |
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.
@tgrandje there are files (.svg, .xml...) and docstrings that should not have been changed, could you check what happened (maybe you applied it during tests and did not undo it)?
Well, that's just the first hooks, removing trailing whitespaces (speaking from memory). Nothing to worry (let's hope...) |
@tgrandje well, the |
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-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.
@tfardet I think that's the part which impacted svgs and the like, nothing to worry too much
@tfardet ok, this time it might be good 😄 ! I just tested (and stopped) the CI, it passed and ran black and pyflakes without problems ! |
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 to me, I'll merge it right away, thanks @tgrandje !
I ran pytest and pyflakes on the whole code. I've also cleaned some comment (removed those which seemed unnecessary and kept those I had a doubt on), but that should be marginal.
There are also cases where I was completly sure of what to do, regarding some unused variables. Just to be sure, I flagged those in a different issue.
I suggest merging that PR if possible before merging anything else (I'll clean the current PR resolving github timeouts afterwards for instance).