Skip to content
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

Merged
merged 34 commits into from
Jan 24, 2025
Merged

black, prune & precommits #234

merged 34 commits into from
Jan 24, 2025

Conversation

tgrandje
Copy link
Collaborator

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).

Copy link
Collaborator

@tfardet tfardet left a 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be logged?

Copy link
Collaborator Author

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?

pynsee/geodata/_get_full_list_wfs.py Show resolved Hide resolved
pynsee/localdata/_get_insee_local_onegeo.py Outdated Show resolved Hide resolved
pynsee/macrodata/_download_idbank_list.py Outdated Show resolved Hide resolved
pynsee/macrodata/get_series_list.py Outdated Show resolved Hide resolved
pynsee/sirene/search_sirene.py Outdated Show resolved Hide resolved
@tgrandje
Copy link
Collaborator Author

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 😉 !

Copy link
Collaborator

@tfardet tfardet left a 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
Copy link
Collaborator

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

Copy link
Collaborator Author

@tgrandje tgrandje Jan 23, 2025

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 :

- 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

Copy link
Collaborator

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!

.pre-commit-config.yaml Show resolved Hide resolved
CONTRIBUTING.md Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
tgrandje and others added 7 commits January 23, 2025 09:57
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>
@tgrandje tgrandje changed the title black formatting & pyflakes alerts resolution black, prune & precommits Jan 23, 2025
@tgrandje
Copy link
Collaborator Author

TODO : update CI

Copy link
Collaborator

@tfardet tfardet left a 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)?

pynsee/sirene/search_sirene.py Show resolved Hide resolved
@tgrandje
Copy link
Collaborator Author

@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...)

@tfardet
Copy link
Collaborator

tfardet commented Jan 24, 2025

@tgrandje well, the .black file says that it should only touch .py files, so something is not consistent here...

Comment on lines +5 to +8
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
Copy link
Collaborator Author

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

@tgrandje
Copy link
Collaborator Author

@tfardet ok, this time it might be good 😄 !

I just tested (and stopped) the CI, it passed and ran black and pyflakes without problems !

Copy link
Collaborator

@tfardet tfardet left a 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 !

@tfardet tfardet merged commit 91bdadb into master Jan 24, 2025
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants