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

Make gpuCI and pre-commit style configurations consistent #8215

Merged
merged 27 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2a7498a
Fix black, flake8 checks, attempt to fix isort
charlesbluca May 11, 2021
1b1a7e3
Fix clang-format checks
charlesbluca May 11, 2021
8eab7ab
Add new isort checks to gpuCI script
charlesbluca May 11, 2021
42ecf31
Add new isort return values to array
charlesbluca May 13, 2021
f2ad3b2
Exclude __init__.py files for isort-cudf
charlesbluca Jun 4, 2021
4cb923b
Bump isort to 5.6.0, include cython/pyi in checks
charlesbluca Jun 4, 2021
00ecc51
Bump isort to 5.6.4
charlesbluca Jun 14, 2021
220a722
Run updated hooks across codebase
charlesbluca Jun 21, 2021
bdb23db
Revert "Run updated hooks across codebase"
charlesbluca Jun 21, 2021
4bc7b69
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jun 21, 2021
c301e3f
Run hooks again
charlesbluca Jun 21, 2021
6cead3b
Temporary fix for style failures
charlesbluca Jun 22, 2021
a9f555e
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jun 24, 2021
d34eeb9
Run pre-commit hooks again
charlesbluca Jun 24, 2021
994e770
Retain old import style with isort skip
charlesbluca Jun 24, 2021
88eca4e
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jun 24, 2021
44399d3
Bump copyright on affected files
charlesbluca Jun 24, 2021
1dc0d9b
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jun 28, 2021
ab166a0
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jun 30, 2021
ef6691c
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jun 30, 2021
bb622a9
Run hooks again
charlesbluca Jun 30, 2021
323d3a5
Fix test failures
charlesbluca Jul 2, 2021
02ab8e6
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jul 2, 2021
1655435
Fix merge conflicts
charlesbluca Jul 8, 2021
31a1a23
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jul 8, 2021
3e799bd
Fix merge conflicts
charlesbluca Jul 13, 2021
367e1cd
Merge remote-tracking branch 'upstream/branch-21.08' into consistent-…
charlesbluca Jul 13, 2021
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
25 changes: 21 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,38 @@ repos:
rev: 5.0.7
hooks:
- id: isort
alias: isort-cudf
name: isort-cudf
args: ["--settings-path=python/cudf/setup.cfg"]
charlesbluca marked this conversation as resolved.
Show resolved Hide resolved
files: python/cudf/.*
- id: isort
alias: isort-cudf-kafka
name: isort-cudf-kafka
args: ["--settings-path=python/cudf_kafka/setup.cfg"]
files: python/cudf_kafka/.*
- id: isort
alias: isort-custreamz
name: isort-custreamz
args: ["--settings-path=python/custreamz/setup.cfg"]
files: python/custreamz/.*
- id: isort
alias: isort-dask-cudf
name: isort-dask-cudf
args: ["--settings-path=python/dask_cudf/setup.cfg"]
files: python/dask_cudf/.*
- repo: https://github.com/ambv/black
rev: 19.10b0
hooks:
- id: black
files: python/.*
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
alias: flake8
name: flake8
args: ["--config=python/.flake8"]
types: [python]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
files: python/.*\.py$
- id: flake8
alias: flake8-cython
name: flake8-cython
Expand Down
62 changes: 49 additions & 13 deletions ci/checks/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,77 @@ LANG=C.UTF-8
# Activate common conda env
source activate gdf

# Run isort and get results/return code
ISORT=`isort --check-only python/**/*.py`
ISORT_RETVAL=$?
# Run isort-cudf and get results/return code
ISORT_CUDF=`isort python/cudf --check-only --settings-path=python/cudf/setup.cfg --skip-glob *.pyx --skip-glob *.pyi 2>&1`
Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason, the pre-commit hooks for isort automatically skip Cython files, while the CLI does not, so I had to specify to skip them here. Do we want package sorting for Cython files?

Copy link
Member Author

@charlesbluca charlesbluca May 14, 2021

Choose a reason for hiding this comment

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

Looks like we can get Cython/PYI resorting in pre-commit's isort hook with:

types: [text]
types_or: [python, cython, pyi]

So if we would like package resorting on Cython and/or module files it's now totally doable.

ISORT_CUDF_RETVAL=$?

# Run isort-cudf-kafka and get results/return code
ISORT_CUDF_KAFKA=`isort python/cudf_kafka --check-only --settings-path=python/cudf_kafka/setup.cfg --skip-glob *.pyx --skip-glob *.pyi 2>&1`
ISORT_CUDF_KAFKA_RETVAL=$?

# Run isort-custreamz and get results/return code
ISORT_CUSTREAMZ=`isort python/custreamz --check-only --settings-path=python/custreamz/setup.cfg --skip-glob *.pyx --skip-glob *.pyi 2>&1`
ISORT_CUSTREAMZ_RETVAL=$?

# Run isort-dask-cudf and get results/return code
ISORT_DASK_CUDF=`isort python/dask_cudf --check-only --settings-path=python/dask_cudf/setup.cfg --skip-glob *.pyx --skip-glob *.pyi 2>&1`
ISORT_DASK_CUDF_RETVAL=$?
ajschmidt8 marked this conversation as resolved.
Show resolved Hide resolved

# Run black and get results/return code
BLACK=`black --check python`
BLACK=`black --check python 2>&1`
BLACK_RETVAL=$?

# Run flake8 and get results/return code
FLAKE=`flake8 --config=python/.flake8 python`
FLAKE=`flake8 --config=python/.flake8 python 2>&1`
FLAKE_RETVAL=$?

# Run flake8-cython and get results/return code
FLAKE_CYTHON=`flake8 --config=python/.flake8.cython`
FLAKE_CYTHON=`flake8 --config=python/.flake8.cython 2>&1`
FLAKE_CYTHON_RETVAL=$?

# Run mypy and get results/return code
MYPY_CUDF=`mypy --config=python/cudf/setup.cfg python/cudf/cudf`
MYPY_CUDF=`mypy --config=python/cudf/setup.cfg python/cudf/cudf 2>&1`
MYPY_CUDF_RETVAL=$?

# Run pydocstyle and get results/return code
PYDOCSTYLE=`pydocstyle --config=python/.flake8 python`
PYDOCSTYLE=`pydocstyle --config=python/.flake8 python 2>&1`
PYDOCSTYLE_RETVAL=$?

# Run clang-format and check for a consistent code format
CLANG_FORMAT=`python cpp/scripts/run-clang-format.py 2>&1`
CLANG_FORMAT_RETVAL=$?

# Output results if failure otherwise show pass
if [ "$ISORT_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: isort style check; begin output\n\n"
echo -e "$ISORT"
echo -e "\n\n>>>> FAILED: isort style check; end output\n\n"
if [ "$ISORT_CUDF_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: isort-cudf style check; begin output\n\n"
echo -e "$ISORT_CUDF"
echo -e "\n\n>>>> FAILED: isort-cudf style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: isort-cudf style check\n\n"
fi

if [ "$ISORT_CUDF_KAFKA_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: isort-cudf-kafka style check; begin output\n\n"
echo -e "$ISORT_CUDF_KAFKA"
echo -e "\n\n>>>> FAILED: isort-cudf-kafka style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: isort-cudf-kafka style check\n\n"
fi

if [ "$ISORT_CUSTREAMZ_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: isort-custreamz style check; begin output\n\n"
echo -e "$ISORT_CUSTREAMZ"
echo -e "\n\n>>>> FAILED: isort-custreamz style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: isort-custreamz style check\n\n"
fi

if [ "$ISORT_DASK_CUDF_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: isort-dask-cudf style check; begin output\n\n"
echo -e "$ISORT_DASK_CUDF"
echo -e "\n\n>>>> FAILED: isort-dask-cudf style check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: isort style check\n\n"
echo -e "\n\n>>>> PASSED: isort-dask-cudf style check\n\n"
fi

if [ "$BLACK_RETVAL" != "0" ]; then
Expand Down
4 changes: 2 additions & 2 deletions cpp/scripts/run-clang-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
DEFAULT_DIRS = [
charlesbluca marked this conversation as resolved.
Show resolved Hide resolved
"cpp/benchmarks",
"cpp/include",
"cpp/include/cudf",
hyperbolic2346 marked this conversation as resolved.
Show resolved Hide resolved
"cpp/include/nvtext",
"cpp/libcudf_kafka",
"cpp/src",
"cpp/tests",
"java/src/main/native",
]


Expand Down