-
Notifications
You must be signed in to change notification settings - Fork 75
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 GitHub action to format and lint code #96
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.
Very nice! Just a few minor comments.
You mention in the PR description that it would be advisable to adjust the CONTRIBUTING.md. I agree, but why not modify the file directly in this PR?
@csadorf Thanks for your comments! The rationale for not updating the CONTRIBUTING document here is because it's in the triton-inference-server/server repo. When we roll these changes out to all repos next week, we'll update the CONTRIBUTING document in the server repo in the same PR. |
66bbc8e
to
dae7ee2
Compare
@@ -34,4 +35,4 @@ BinPackArguments: true | |||
BinPackParameters: true | |||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | |||
|
|||
IndentCaseLabels: true |
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.
Nit: newline
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.
There should be a newline. :) I think Git only shows the lack of a newline (see red/removed area vs. green/added area).
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 was going to ask whether adding "black" as a profile in the pyproject.toml would impact the other PRs, but it looks like you've already updated them. Great work!
This pull request adds a pre-commit to run the following:
In addition, this adds these native pre-commit hooks, details here:
To run these locally, you can install pre-commit via
pip install pre-commit
, then go into the repo and runpre-commit install
. After that has been done once, you just need to runpre-commit run --all-files
any time you want to apply them. Once installed, it should run automatically on commit for files included in a commit. To correct spelling errors found by codespell when possible, you can install codespell (pip install codespell
and potentiallypip install --upgrade codespell
to use the toml file in the directory) and callcodespell -w <path>
.This pull request also adds a GitHub action so that these are run for every pull request and push to main. The core changes are in pre-commit.yml, pre-commit-config.yaml, and pyproject.toml. This also removes the old formatter (.clang-format, tools/format.py, tools/pre-commit). The rest of the changes are the effect of applying the action to the current repo.
Note: When this is merged, we'll want to modify the CONTRIBUTING document in the server repository at the same time to update the instructions on running the formatter.