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

Add flake8, yapf, and isort pre-commit hooks. #420

Merged
merged 9 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ repos:
hooks:
- id: rapids-dependency-file-generator
args: ["--clean"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--settings-file=./python/setup.cfg"]
files: ^python/
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
args: ["--config=./python/setup.cfg"]
files: ^python/
- repo: https://github.com/google/yapf
rev: v0.40.2
hooks:
- id: yapf
args: ["--style", "./python/setup.cfg"]
files: ^python/

default_language_version:
python: python3
1 change: 0 additions & 1 deletion ci/githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@ export CHANGED_FILES=$(GIT_DIFF_ARGS="--cached --name-only" get_modified_files)

if [[ "${CHANGED_FILES}" != "" ]]; then
run_and_check "python3 ci/scripts/copyright.py --git-diff-staged --update-current-year --verify-apache-v2 --git-add"
run_and_check "ci/scripts/python_checks.sh"
SKIP_CLANG_TIDY=1 SKIP_IWYU=1 run_and_check "ci/scripts/cpp_checks.sh"
fi
3 changes: 0 additions & 3 deletions ci/scripts/github/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,5 @@ ${MRC_ROOT}/ci/scripts/version_checks.sh
rapids-logger "Running C++ style checks"
${MRC_ROOT}/ci/scripts/cpp_checks.sh

rapids-logger "Runing Python style checks"
${MRC_ROOT}/ci/scripts/python_checks.sh

rapids-logger "Checking copyright headers"
python ${MRC_ROOT}/ci/scripts/copyright.py --verify-apache-v2 --git-diff-commits ${CHANGE_TARGET} ${GIT_COMMIT}
105 changes: 0 additions & 105 deletions ci/scripts/python_checks.sh

This file was deleted.

2 changes: 0 additions & 2 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies:
- cuda-version=11.8
- cxx-compiler
- doxygen=1.9.2
- flake8
- gcovr=5.0
- gdb
- glog=0.6
Expand All @@ -52,5 +51,4 @@ dependencies:
- python=3.10
- scikit-build>=0.17
- ucx=1.14
- yapf
name: all_cuda-118_arch-x86_64
2 changes: 0 additions & 2 deletions conda/environments/ci_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
- cuda-version=11.8
- cxx-compiler
- doxygen=1.9.2
- flake8
- gcovr=5.0
- glog=0.6
- graphviz=3.0
Expand All @@ -42,5 +41,4 @@ dependencies:
- python=3.10
- scikit-build>=0.17
- ucx=1.14
- yapf
name: ci_cuda-118_arch-x86_64
2 changes: 0 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ dependencies:
common:
- output_types: [conda]
packages:
- flake8
- yapf
- include-what-you-use=0.20

testing:
Expand Down
3 changes: 1 addition & 2 deletions docs/quickstart/python/mrc_qs_python/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
import re
import subprocess
import sys
from typing import Callable
from typing import Dict
from typing import Callable, Dict


def get_keywords():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@

import dataclasses

import mrc
from mrc.core import operators as ops

import mrc


@dataclasses.dataclass
class MyCustomClass:
Expand Down
3 changes: 1 addition & 2 deletions docs/quickstart/python/versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@
import re
import subprocess
import sys
from typing import Callable
from typing import Dict
from typing import Callable, Dict


class VersioneerConfig:
Expand Down