Skip to content

Commit

Permalink
Merge pull request #13 from ilastik/fix-float-warning
Browse files Browse the repository at this point in the history
Fix float warning
  • Loading branch information
k-dominik authored Aug 13, 2024
2 parents 9b3ddf4 + 25a309d commit 76f4648
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 40 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions dev/environment-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: ndstructs-dev
channels:
- defaults
- conda-forge
- nodefaults
dependencies:
- black
- bumpversion
- numpy
- scikit-image
- h5py
- pre_commit
- pytest <5.4
- python >=3.7
- pytest
- python >=3.8
- imageio
- fs
4 changes: 2 additions & 2 deletions ndstructs/array5D.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions ndstructs/datasource/DataSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion ndstructs/utils/JsonSerializable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[tool.black]
line-length = 120
target-version = ['py37']
target-version = ['py38', 'py39', 'py310', 'py311']
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]},
)
5 changes: 3 additions & 2 deletions tests/test_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import h5py
import json
import shutil
import skimage.io
import imageio.v3 as iio


# fmt: off
raw = np.asarray([
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit 76f4648

Please sign in to comment.