Skip to content

Commit

Permalink
Drop Python 3.9 support (#766)
Browse files Browse the repository at this point in the history
Contributes to rapidsai/build-planning#88

Finishes the work of dropping Python 3.9 support.

This project stopped building / testing against Python 3.9 as of rapidsai/shared-workflows#235.
This PR updates configuration and docs to reflect that.

## Notes for Reviewers

### How I tested this

Checked that there were no remaining uses like this:

```shell
git grep -E '3\.9'
git grep '39'
git grep 'py39'
```

And similar for variations on Python 3.8 (to catch things that were missed the last time this was done).

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Gregory Lee (https://github.com/grlee77)
  - https://github.com/jakirkham
  - Bradley Dice (https://github.com/bdice)
  - Jake Awe (https://github.com/AyodeAwe)

URL: #766
  • Loading branch information
jameslamb authored Aug 22, 2024
1 parent c004b6f commit de6bfbb
Show file tree
Hide file tree
Showing 42 changed files with 125 additions and 116 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ repos:
- id: black
args: ["--config", "python/cucim/pyproject.toml"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.6.1
hooks:
- id: ruff
types_or: [python, pyi]
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --config, "python/cucim/pyproject.toml"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/skimage/_image_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import pandas as pd
import scipy.ndimage
import skimage.data

from cucim.time import repeat


Expand All @@ -23,7 +24,7 @@ def product_dict(**kwargs):
yield dict(zip(keys, instance))


class ImageBench(object):
class ImageBench:
def __init__(
self,
function_name,
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/skimage/bench_convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""
import cupy as cp
import cupyx.scipy.ndimage as ndi
from cupyx.profiler import benchmark

from cucim.skimage._vendored.ndimage import ( # noqa: F401
convolve1d,
correlate1d,
Expand All @@ -16,7 +18,6 @@
uniform_filter,
uniform_filter1d,
)
from cupyx.profiler import benchmark

d = cp.cuda.Device()

Expand Down
7 changes: 4 additions & 3 deletions benchmarks/skimage/cucim_color_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.color
import cupy
import cupy as cp
import cupyx.scipy.ndimage
Expand All @@ -14,6 +12,9 @@
import skimage.color
from _image_bench import ImageBench

import cucim.skimage
import cucim.skimage.color

func_name_choices = [
"convert_colorspace",
"rgb2hed",
Expand Down Expand Up @@ -223,7 +224,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/skimage/cucim_exposure_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.exposure
import cupy
import cupy as cp
import numpy as np
Expand All @@ -12,6 +10,9 @@
import skimage.exposure
from _image_bench import ImageBench

import cucim.skimage
import cucim.skimage.exposure


class ExposureBench(ImageBench):
def set_args(self, dtype):
Expand Down Expand Up @@ -129,7 +130,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
9 changes: 5 additions & 4 deletions benchmarks/skimage/cucim_feature_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.feature
import cupy as cp
import numpy as np
import pandas as pd
import skimage
import skimage.feature
from _image_bench import ImageBench
from cucim.skimage import exposure
from skimage import data, draw

import cucim.skimage
import cucim.skimage.feature
from cucim.skimage import exposure


class BlobDetectionBench(ImageBench):
def set_args(self, dtype):
Expand Down Expand Up @@ -218,7 +219,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
7 changes: 4 additions & 3 deletions benchmarks/skimage/cucim_filters_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.filters
import numpy as np
import pandas as pd
import skimage
import skimage.filters
from _image_bench import ImageBench

import cucim.skimage
import cucim.skimage.filters


def main(args):
pfile = "cucim_filters_results.pickle"
Expand Down Expand Up @@ -189,7 +190,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
7 changes: 4 additions & 3 deletions benchmarks/skimage/cucim_measure_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.measure
import cupy as cp
import numpy as np
import pandas as pd
Expand All @@ -13,6 +11,9 @@
from _image_bench import ImageBench
from cucim_metrics_bench import MetricsBench

import cucim.skimage
import cucim.skimage.measure


class LabelBench(ImageBench):
def __init__(
Expand Down Expand Up @@ -328,7 +329,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
7 changes: 4 additions & 3 deletions benchmarks/skimage/cucim_metrics_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.metrics
import cupy as cp
import numpy as np
import pandas as pd
import skimage
import skimage.metrics
from _image_bench import ImageBench

import cucim.skimage
import cucim.skimage.metrics
from cucim.skimage import data, measure


Expand Down Expand Up @@ -176,7 +177,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
7 changes: 4 additions & 3 deletions benchmarks/skimage/cucim_morphology_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.morphology
import cupy as cp
import numpy as np
import pandas as pd
Expand All @@ -17,6 +15,9 @@
import skimage.morphology
from _image_bench import ImageBench

import cucim.skimage
import cucim.skimage.morphology


class BinaryMorphologyBench(ImageBench):
def __init__(
Expand Down Expand Up @@ -281,7 +282,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/skimage/cucim_registration_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.registration
import cupy as cp
import numpy as np
import pandas as pd
import skimage
import skimage.registration
from _image_bench import ImageBench

import cucim.skimage
import cucim.skimage.registration


class RegistrationBench(ImageBench):
def set_args(self, dtype):
Expand Down Expand Up @@ -145,7 +146,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
9 changes: 5 additions & 4 deletions benchmarks/skimage/cucim_restoration_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.restoration
import cupy as cp
import cupyx.scipy.ndimage as ndi
import numpy as np
import pandas as pd
import skimage
import skimage.restoration
from _image_bench import ImageBench
from cucim.skimage.restoration import denoise_tv_chambolle as tv_gpu
from skimage.restoration import denoise_tv_chambolle as tv_cpu

import cucim.skimage
import cucim.skimage.restoration
from cucim.skimage.restoration import denoise_tv_chambolle as tv_gpu


class DenoiseBench(ImageBench):
def set_args(self, dtype):
Expand Down Expand Up @@ -180,7 +181,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/skimage/cucim_segmentation_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import os
import pickle

import cucim.skimage
import cupy as cp
import numpy as np
import pandas as pd
import skimage
import skimage.segmentation
from _image_bench import ImageBench

import cucim.skimage
from cucim.skimage import data, measure


Expand Down Expand Up @@ -296,7 +297,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/skimage/cucim_transform_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.transform
import numpy as np
import pandas as pd
import skimage
import skimage.transform
from _image_bench import ImageBench

import cucim.skimage
import cucim.skimage.transform


def main(args):
pfile = "cucim_transform_results.pickle"
Expand Down Expand Up @@ -164,7 +165,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cupyx_scipy_ndimage_filter_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
2 changes: 1 addition & 1 deletion benchmarks/skimage/cupyx_scipy_ndimage_fourier_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
2 changes: 1 addition & 1 deletion benchmarks/skimage/cupyx_scipy_ndimage_interp_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
2 changes: 1 addition & 1 deletion benchmarks/skimage/cupyx_scipy_ndimage_morphology_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
Loading

0 comments on commit de6bfbb

Please sign in to comment.