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 all 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
70 changes: 0 additions & 70 deletions ci/conda/environments/dev_env.yml

This file was deleted.

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.

1 change: 1 addition & 0 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies:
- llvmdev=16
- ninja=1.10
- nlohmann_json=3.9
- numactl-libs-cos7-x86_64
- numpy>=1.21
- pkg-config=0.29
- pre-commit
Expand Down
3 changes: 1 addition & 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 @@ -33,6 +32,7 @@ dependencies:
- librmm=23.06
- ninja=1.10
- nlohmann_json=3.9
- numactl-libs-cos7-x86_64
- pkg-config=0.29
- pre-commit
- pybind11-stubgen=0.10
Expand All @@ -42,5 +42,4 @@ dependencies:
- python=3.10
- scikit-build>=0.17
- ucx=1.14
- yapf
name: ci_cuda-118_arch-x86_64
5 changes: 3 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ dependencies:
- librmm=23.06
- ninja=1.10
- nlohmann_json=3.9
- numactl-libs-cos7-x86_64
- pkg-config=0.29
- pybind11-stubgen=0.10
- python=3.10
Expand All @@ -84,17 +85,17 @@ dependencies:
- clang=16
- clangdev=16
- clangxx=16
- flake8
- gdb
- libclang-cpp=16
- libclang=16
- llvmdev=16
- yapf

code_style:
common:
- output_types: [conda]
packages:
- flake8
- yapf
cwharris marked this conversation as resolved.
Show resolved Hide resolved
- 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