diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..68fc5b4 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,32 @@ +name: deploy + +on: + push: + tags: + - '0.*' + +jobs: + package: + runs-on: ubuntu-latest + environment: conda-deploy + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + auto-activate-base: true + activate-environment: "" + channel-priority: strict + miniforge-version: latest + - name: install build dependencies + run: | + conda install -n base -c conda-forge boa setuptools_scm anaconda-client -y + - name: linux conda build and upload + shell: bash -l {0} + env: + ANACONDA_API_TOKEN: ${{ secrets.CONDA_UPLOAD_TOKEN }} + run: | + conda config --set anaconda_upload yes + conda build conda-forge --user ilastik-forge conda-recipe diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a7ad351 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + conda-noarch-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + auto-activate-base: true + activate-environment: "" + channel-priority: strict + miniforge-version: latest + - name: install common conda dependencies + run: conda install -n base -q conda-build pip anaconda-client -y + - name: linux conda build test + shell: bash -l {0} + run: conda build -c conda-forge conda-recipe diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1e6c26c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: python -python: - - 3.7 - -before_install: - - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - - chmod +x miniconda.sh - - ./miniconda.sh -b - - export PATH=$HOME/miniconda3/bin:$PATH - - conda update --yes -q conda -c conda-forge - - conda config --set always_yes true - - conda config --set anaconda_upload no - -install: - - conda install -q conda-build pip anaconda-client - - conda build -c conda-forge conda-recipe - -script: - - echo "noop so travis doesn't fail. Conda build does everything" - -deploy: - - provider: script - script: anaconda -t $CONDA_UPLOAD_TOKEN upload $HOME/miniconda3/conda-bld/**/ndstructs-*.tar.bz2 --label staging - on: - tags: true - skip_cleanup: true diff --git a/dev/environment-dev.yaml b/dev/environment-dev.yaml index b2fb844..ec69c7c 100644 --- a/dev/environment-dev.yaml +++ b/dev/environment-dev.yaml @@ -1,7 +1,7 @@ name: ndstructs-dev channels: - - defaults - conda-forge + - nodefaults dependencies: - black - bumpversion @@ -9,6 +9,7 @@ dependencies: - scikit-image - h5py - pre_commit - - pytest <5.4 - - python >=3.7 + - pytest + - python >=3.8 + - imageio - fs diff --git a/ndstructs/array5D.py b/ndstructs/array5D.py index 506d249..b7d6335 100644 --- a/ndstructs/array5D.py +++ b/ndstructs/array5D.py @@ -2,7 +2,7 @@ from typing import Iterator, Tuple, Iterable, Optional, Union, TypeVar, Type, cast, Sequence import numpy as np from skimage import measure as skmeasure -import skimage.io +import imageio.v3 as iio import io import os import uuid @@ -72,7 +72,7 @@ def to_json_data(self) -> dict: @classmethod def from_file(cls: Type[Arr], filelike: io.IOBase, location: Point5D = Point5D.zero()) -> Arr: - data = skimage.io.imread(filelike) + data = iio.imread(filelike) return cls(data, "yxc"[: len(data.shape)], location=location) def __repr__(self) -> str: diff --git a/ndstructs/datasource/DataSource.py b/ndstructs/datasource/DataSource.py index d1153c7..2bcb804 100644 --- a/ndstructs/datasource/DataSource.py +++ b/ndstructs/datasource/DataSource.py @@ -8,7 +8,7 @@ import h5py import numpy as np -import skimage.io +import imageio.v3 as iio from fs.base import FS from fs.errors import ResourceNotFound from fs.osfs import OSFS @@ -255,7 +255,7 @@ def __init__( self, path: Path, *, location: Point5D = Point5D.zero(), filesystem: FS, tile_shape: Optional[Shape5D] = None ): try: - raw_data = skimage.io.imread(filesystem.openbin(path.as_posix())) + raw_data = iio.imread(filesystem.openbin(path.as_posix())) except ValueError: raise UnsupportedUrlException(path) axiskeys = "yxc"[: len(raw_data.shape)] diff --git a/ndstructs/utils/JsonSerializable.py b/ndstructs/utils/JsonSerializable.py index 4fbba57..b081e34 100644 --- a/ndstructs/utils/JsonSerializable.py +++ b/ndstructs/utils/JsonSerializable.py @@ -90,7 +90,7 @@ def from_json_data(cls, data, *, dereferencer: Optional[Dereferencer] = None, in for type_parts in itertools.product(["u", ""], ["int"], ["8", "16", "32", "64"]) ] ) -float_classes = tuple([float] + [np.float, np.float16, np.float32, np.float64]) +float_classes = tuple([float] + [np.float16, np.float32, np.float64]) Referencer = Callable[[Any], Optional["JsonReference"]] diff --git a/pyproject.toml b/pyproject.toml index 2f7cc3f..8752e21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [tool.black] line-length = 120 -target-version = ['py37'] +target-version = ['py38', 'py39', 'py310', 'py311'] diff --git a/setup.py b/setup.py index c766061..906feb6 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ license="MIT", description="Short description", packages=["ndstructs", "ndstructs.utils", "ndstructs.datasource", "ndstructs.datasink", "ndstructs.caching"], - python_requires=">=3.7", - install_requires=["numpy", "scikit-image", "h5py", "fs", "typing_extensions"], - extras_require={"dev": ["pytest<5.4"]}, + python_requires=">=3.8", + install_requires=["numpy", "scikit-image", "h5py", "fs", "typing_extensions", "imageio"], + extras_require={"dev": ["pytest"]}, ) diff --git a/tests/test_datasource.py b/tests/test_datasource.py index df8cbb3..d27598e 100644 --- a/tests/test_datasource.py +++ b/tests/test_datasource.py @@ -20,7 +20,8 @@ import h5py import json import shutil -import skimage.io +import imageio.v3 as iio + # fmt: off raw = np.asarray([ @@ -64,7 +65,7 @@ def create_png(array: Array5D) -> Path: png_path = tempfile.mkstemp()[1] + ".png" - skimage.io.imsave(png_path, array.raw("yxc")) + iio.imwrite(png_path, array.raw("yxc").squeeze()) return Path(png_path)