Closed ayushdg closed 3 months ago
Looks like the .pre-commit-config.yaml
of both NeMo Aligner and NeMo are slightly different than ours. Can we change ours to match theirs exactly, or is there a reason ours should be different?
Looks like the .pre-commit-config.yaml of both NeMo Aligner and NeMo are slightly different than ours. Can we change ours to match theirs exactly, or is there a reason ours should be different?
There's no reason for them to match exactly, some of it depends on the practices we want to follow for the repo so it's good to go over the differences:
Trailing-whitespace
, end-of-file-fixer
unless we find specific examples in the repo where it doesn't make sense.
Full list of hooks here.black
profile should be the case since we're using black
as recommended by isort
.flake8
is one option that combines rules from PyCodeStyle and PyFlakes. black
formatting arguably fixes some of these rules, but happy to omit this, don't have a strong preference.ci
: I'm happy to explore using pre-commit.ci over the pre-commit action directly provided it doesn't require any additional enterprise approvals. Ok cool. Thanks for the clarification.
Isort: I'd argue that adding the black profile should be the case since we're using black as recommended by isort.
Actually I stand corrected, other repos do use this but specify the config in their pyproject.toml file. I'll probably do the same.
This also has the side effect of pre-commit.ci auto formatting all the files. @ryantwolf Are you okay updating all the file formats in this PR?
It had to happen at some point haha. Let's reformat the code 🫡
Had some weirdness during the rebasing with signoff. Will open a new PR
The aim of the PR is to add pre-commit configs and a GHA for style checks. The PR does not attempt to fix all the style failures present in the repo. That will be done in a followup PR.
The config ends up using
isort, black & flake8
(some of it included in the contributing guide).Happy to also explore ruff which should be a much faster drop in replacement for some of the tools mentioned above and has been adopted by many large python projects.