diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 58656d15b..2339c6766 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,10 +15,22 @@ repos: hooks: - id: isort files: ^python/cucim/src/.* - args: ["--settings-path=python/cucim/setup.cfg"] - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + args: ["--settings-path=python/cucim/pyproject.toml"] + - repo: https://github.com/psf/black + rev: 23.3.0 hooks: - - id: flake8 - args: ["--config=python/cucim/setup.cfg"] - files: ^python/cucim/.* + - id: black + files: (python|legate)/.* + args: ["--config", "python/cucim/pyproject.toml"] + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.278 + hooks: + - id: ruff + files: python/.*$ + - repo: https://github.com/codespell-project/codespell + rev: v2.2.4 + hooks: + - id: codespell + args: [--toml, python/cucim/pyproject.toml] + additional_dependencies: + - tomli diff --git a/python/cucim/pyproject.toml b/python/cucim/pyproject.toml index 8388c4f17..c5351f058 100644 --- a/python/cucim/pyproject.toml +++ b/python/cucim/pyproject.toml @@ -121,7 +121,7 @@ license-files = ["LICENSE"] # this is only to allow you to run codespell interactively # e.g. via # codespell --toml python/cucim/pyproject.toml . -i 3 -w -skip = "build*,dist,.cache,html,_build,_deps,3rdparty,_static,generated,latex,.git,*.ipynb,LICENSE-3rdparty,jitify_testing" +skip = "build*,dist,.cache,html,_build,_deps,3rdparty,_static,generated,latex,.git,*.ipynb,test_data/input/LICENSE-3rdparty,jitify_testing" # ignore-regex = "" ignore-words-list = "ans,coo,boun,bui,gool,hart,lond,nd,paeth,unser,wronly" quiet-level = 3 diff --git a/python/cucim/src/cucim/__init__.pyi b/python/cucim/src/cucim/__init__.pyi index 63064a411..8c7b467f9 100644 --- a/python/cucim/src/cucim/__init__.pyi +++ b/python/cucim/src/cucim/__init__.pyi @@ -17,17 +17,19 @@ submodules = [] try: import cupy + _is_cupy_available = True - submodules += ['core', 'skimage'] + submodules += ["core", "skimage"] del cupy except ImportError: pass try: from .clara import CuImage, __version__, cli # noqa: F401 + _is_clara_available = True - submodules += ['clara'] + submodules += ["clara"] except ImportError: __version__ = "23.12.00" -__all__ = submodules + ['__version__', 'is_available'] # noqa: F822 +__all__ = submodules + ["__version__", "is_available"] # noqa: F822 diff --git a/python/cucim/src/cucim/skimage/__init__.pyi b/python/cucim/src/cucim/skimage/__init__.pyi index 5af4d4926..8b608db5b 100644 --- a/python/cucim/src/cucim/skimage/__init__.pyi +++ b/python/cucim/src/cucim/skimage/__init__.pyi @@ -1,19 +1,19 @@ import lazy_loader as lazy # noqa: F401 submodules = [ - 'color', - 'data', - 'exposure', - 'feature', - 'filters', - 'measure', - 'metrics', - 'morphology', - 'registration', - 'restoration', - 'segmentation', - 'transform', - 'util', + "color", + "data", + "exposure", + "feature", + "filters", + "measure", + "metrics", + "morphology", + "registration", + "restoration", + "segmentation", + "transform", + "util", ] __all__ = submodules diff --git a/python/cucim/src/cucim/skimage/data/__init__.pyi b/python/cucim/src/cucim/skimage/data/__init__.pyi index 88deb1e76..990729a46 100644 --- a/python/cucim/src/cucim/skimage/data/__init__.pyi +++ b/python/cucim/src/cucim/skimage/data/__init__.pyi @@ -1,5 +1,5 @@ __all__ = [ - 'binary_blobs', + "binary_blobs", ] from ._binary_blobs import binary_blobs diff --git a/python/cucim/src/cucim/skimage/feature/tests/test_corner.py b/python/cucim/src/cucim/skimage/feature/tests/test_corner.py index a95a281a1..3554aadb8 100644 --- a/python/cucim/src/cucim/skimage/feature/tests/test_corner.py +++ b/python/cucim/src/cucim/skimage/feature/tests/test_corner.py @@ -224,7 +224,7 @@ def test_hessian_matrix_3d_xy(use_gaussian_derivatives): hessian_matrix( img, sigma=0.1, - order="nonexistant", + order="nonexistent", use_gaussian_derivatives=use_gaussian_derivatives, ) diff --git a/python/cucim/src/cucim/skimage/filters/__init__.pyi b/python/cucim/src/cucim/skimage/filters/__init__.pyi index 24a2b2e64..185f24eb3 100644 --- a/python/cucim/src/cucim/skimage/filters/__init__.pyi +++ b/python/cucim/src/cucim/skimage/filters/__init__.pyi @@ -1,51 +1,51 @@ __all__ = [ -'LPIFilter2D', -'apply_hysteresis_threshold', -'butterworth', -'correlate_sparse', -'difference_of_gaussians', -'farid', -'farid_h', -'farid_v', -'filter_forward', -'filter_inverse', -'frangi', -'gabor', -'gabor_kernel', -'gaussian', -'hessian', -'laplace', -'median', -'meijering', -'prewitt', -'prewitt_h', -'prewitt_v', -'rank_order', -'roberts', -'roberts_neg_diag', -'roberts_pos_diag', -'sato', -'scharr', -'scharr_h', -'scharr_v', -'sobel', -'sobel_h', -'sobel_v', -'threshold_isodata', -'threshold_li', -'threshold_local', -'threshold_mean', -'threshold_minimum', -'threshold_multiotsu', -'threshold_niblack', -'threshold_otsu', -'threshold_sauvola', -'threshold_triangle', -'threshold_yen', -'try_all_threshold', -'unsharp_mask', -'wiener', -'window' + "LPIFilter2D", + "apply_hysteresis_threshold", + "butterworth", + "correlate_sparse", + "difference_of_gaussians", + "farid", + "farid_h", + "farid_v", + "filter_forward", + "filter_inverse", + "frangi", + "gabor", + "gabor_kernel", + "gaussian", + "hessian", + "laplace", + "median", + "meijering", + "prewitt", + "prewitt_h", + "prewitt_v", + "rank_order", + "roberts", + "roberts_neg_diag", + "roberts_pos_diag", + "sato", + "scharr", + "scharr_h", + "scharr_v", + "sobel", + "sobel_h", + "sobel_v", + "threshold_isodata", + "threshold_li", + "threshold_local", + "threshold_mean", + "threshold_minimum", + "threshold_multiotsu", + "threshold_niblack", + "threshold_otsu", + "threshold_sauvola", + "threshold_triangle", + "threshold_yen", + "try_all_threshold", + "unsharp_mask", + "wiener", + "window", ] from ._fft_based import butterworth