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 support for Python 3.11, require NumPy 1.23+ #704

Merged
merged 5 commits into from
Feb 28, 2024
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
1 change: 0 additions & 1 deletion benchmarks/skimage/_image_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import pandas as pd
import scipy.ndimage
import skimage.data

from cucim.time import repeat


Expand Down
3 changes: 1 addition & 2 deletions benchmarks/skimage/bench_convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"""
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 @@ -18,6 +16,7 @@
uniform_filter,
uniform_filter1d,
)
from cupyx.profiler import benchmark

d = cp.cuda.Device()

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

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

import cucim.skimage
import cucim.skimage.color

func_name_choices = [
"convert_colorspace",
"rgb2hed",
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/skimage/cucim_exposure_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os
import pickle

import cucim.skimage
import cucim.skimage.exposure
import cupy
import cupy as cp
import numpy as np
Expand All @@ -10,9 +12,6 @@
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
7 changes: 3 additions & 4 deletions benchmarks/skimage/cucim_feature_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
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 skimage import data, draw

import cucim.skimage
import cucim.skimage.feature
from cucim.skimage import exposure
from skimage import data, draw


class BlobDetectionBench(ImageBench):
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/skimage/cucim_filters_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
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
5 changes: 2 additions & 3 deletions benchmarks/skimage/cucim_measure_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
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 @@ -11,9 +13,6 @@
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
5 changes: 2 additions & 3 deletions benchmarks/skimage/cucim_metrics_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
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
5 changes: 2 additions & 3 deletions benchmarks/skimage/cucim_morphology_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
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 @@ -15,9 +17,6 @@
import skimage.morphology
from _image_bench import ImageBench

import cucim.skimage
import cucim.skimage.morphology


class BinaryMorphologyBench(ImageBench):
def __init__(
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/skimage/cucim_registration_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
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
7 changes: 3 additions & 4 deletions benchmarks/skimage/cucim_restoration_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
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 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
from skimage.restoration import denoise_tv_chambolle as tv_cpu


class DenoiseBench(ImageBench):
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/skimage/cucim_segmentation_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
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
5 changes: 2 additions & 3 deletions benchmarks/skimage/cucim_transform_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
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
4 changes: 1 addition & 3 deletions ci/wheel_smoke_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import cupy as cp

import cucim
import cucim.skimage

import cupy as cp

if __name__ == "__main__":
# verify that all top-level modules are available
Expand Down
4 changes: 2 additions & 2 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- matplotlib-base
- nbsphinx
- ninja
- numpy>=1.21.3
- numpy>=1.23.4
- numpydoc>=1.5
- nvcc_linux-64=11.8
- openslide-python>=1.3.0
Expand All @@ -40,7 +40,7 @@ dependencies:
- pytest-lazy-fixture>=0.6.3
- pytest-xdist
- pytest>=6.2.4,<8.0.0a0
- python>=3.8,<3.11
- python>=3.8,<3.12
- pywavelets>=1.0
- recommonmark
- scikit-image>=0.19.0,<0.23.0a0
Expand Down
4 changes: 2 additions & 2 deletions conda/environments/all_cuda-122_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- matplotlib-base
- nbsphinx
- ninja
- numpy>=1.21.3
- numpy>=1.23.4
- numpydoc>=1.5
- openslide-python>=1.3.0
- pip
Expand All @@ -39,7 +39,7 @@ dependencies:
- pytest-lazy-fixture>=0.6.3
- pytest-xdist
- pytest>=6.2.4,<8.0.0a0
- python>=3.8,<3.11
- python>=3.8,<3.12
- pywavelets>=1.0
- recommonmark
- scikit-image>=0.19.0,<0.23.0a0
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cucim/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ requirements:
{% endif %}
- cupy >=12.0.0
- libcucim ={{ version }}
- numpy 1.21
- numpy 1.23
KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
- python
- scikit-image >=0.19.0,<0.23.0a0
- scipy
Expand Down
8 changes: 6 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,12 @@ dependencies:
packages:
- python=3.10
- matrix:
py: "3.11"
packages:
- python>=3.8,<3.11
- python=3.11
- matrix:
packages:
- python>=3.8,<3.12
run:
common:
- output_types: [conda, requirements, pyproject]
Expand All @@ -246,7 +250,7 @@ dependencies:
- output_types: conda
packages:
- cupy>=12.0.0
- numpy>=1.21.3
- numpy>=1.23.4
# All dependencies below this point are specific to `cucim.clara` and
# are not needed for either `cucim.core` or `cucim.skimage`. I did
# not include these under a "pyproject" output so that it is still
Expand Down
3 changes: 1 addition & 2 deletions examples/python/distance_transform_edt_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
print("This demo requires the matplotlib and colorcet packages.")
raise (e)

from skimage import data

from cucim.core.operations.morphology import distance_transform_edt
from cucim.skimage.color import label2rgb
from cucim.skimage.segmentation import relabel_sequential
from skimage import data


def coords_to_labels(coords):
Expand Down
5 changes: 2 additions & 3 deletions examples/python/gds_whole_slide/benchmark_round_trip.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import os
from time import time

import cucim.skimage.filters
import cupy as cp
import kvikio
import kvikio.defaults
import numpy as np
from cucim.core.operations.color import image_to_absorbance
from cupyx.profiler import benchmark
from demo_implementation import cupy_to_zarr, read_tiled

import cucim.skimage.filters
from cucim.core.operations.color import image_to_absorbance

data_dir = os.environ.get("WHOLE_SLIDE_DATA_DIR", os.path.dirname("__file__"))
fname = os.path.join(data_dir, "resize.tiff")
if not os.path.exists(fname):
Expand Down
3 changes: 1 addition & 2 deletions examples/python/gds_whole_slide/benchmark_zarr_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import cupy as cp
import kvikio.defaults
import numpy as np
from cucim.core.operations.color import image_to_absorbance
from cupyx.profiler import benchmark
from demo_implementation import cupy_to_zarr, get_n_tiles, read_tiled
from tifffile import TiffFile

from cucim.core.operations.color import image_to_absorbance

data_dir = os.environ.get("WHOLE_SLIDE_DATA_DIR", os.path.dirname("__file__"))
fname = os.path.join(data_dir, "resize.tiff")
if not os.path.exists(fname):
Expand Down
3 changes: 1 addition & 2 deletions examples/python/gds_whole_slide/demo_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
import numpy as np
import openslide
import tifffile
from cucim.clara import filesystem
from kvikio.cufile import IOFuture
from kvikio.zarr import GDSStore
from tifffile import TiffFile
from zarr import DirectoryStore
from zarr.creation import init_array

from cucim.clara import filesystem

"""
Developed with Dask 2022.05.2
zarr >= 2.13.2
Expand Down
3 changes: 1 addition & 2 deletions examples/python/tiff_image/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
import json

import numpy as np
from PIL import Image

from cucim import CuImage
from PIL import Image

img = CuImage("image.tif")

Expand Down
3 changes: 1 addition & 2 deletions experiments/Supporting_Aperio_SVS_Format/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
from itertools import repeat
from time import perf_counter

from openslide import OpenSlide

from cucim import CuImage
from cucim.clara.filesystem import discard_page_cache # noqa: F401
from openslide import OpenSlide


class Timer(ContextDecorator):
Expand Down
Loading
Loading