python3Packages.multiscale-spatial-image: fix build (#516443)

This commit is contained in:
Fabian Affolter
2026-05-05 07:13:34 +00:00
committed by GitHub
11 changed files with 587 additions and 28 deletions
@@ -0,0 +1,42 @@
{
lib,
buildPythonPackage,
fetchPypi,
hatch-vcs,
hatchling,
itkwasm,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "itkwasm-downsample-emscripten";
version = "1.8.1";
pyproject = true;
src = fetchPypi {
pname = "itkwasm_downsample_emscripten";
inherit (finalAttrs) version;
hash = "sha256-kF851K6cy1jozPxd5zE8XVnBAHMljmOqtvpmfmQDZy4=";
};
build-system = [
hatch-vcs
hatchling
];
nativeBuildInputs = [ writableTmpDirAsHomeHook ];
dependencies = [ itkwasm ];
pythonImportsCheck = [ "itkwasm_downsample_emscripten" ];
# No tests available
doCheck = false;
meta = {
description = "Pipelines for downsampling images";
homepage = "https://pypi.org/project/itkwasm-downsample-emscripten";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fab ];
};
})
@@ -0,0 +1,46 @@
{
lib,
buildPythonPackage,
fetchPypi,
hatch-vcs,
hatchling,
importlib-resources,
itkwasm,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "itkwasm-downsample-wasi";
version = "1.8.1";
pyproject = true;
src = fetchPypi {
pname = "itkwasm_downsample_wasi";
inherit (finalAttrs) version;
hash = "sha256-OykKkZRlRGDw+SsK69z6dqh6LY7eUlyHGdZwmkKsMKQ=";
};
build-system = [
hatch-vcs
hatchling
];
nativeBuildInputs = [ writableTmpDirAsHomeHook ];
dependencies = [
importlib-resources
itkwasm
];
# No tests available
doCheck = false;
pythonImportsCheck = [ "itkwasm_downsample_wasi" ];
meta = {
description = "Pipelines for downsampling images";
homepage = "https://pypi.org/project/itkwasm-downsample-wasi";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fab ];
};
})
@@ -0,0 +1,48 @@
{
lib,
buildPythonPackage,
fetchPypi,
hatch-vcs,
hatchling,
itkwasm,
itkwasm-downsample-emscripten,
itkwasm-downsample-wasi,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "itkwasm-downsample";
version = "1.8.1";
pyproject = true;
src = fetchPypi {
pname = "itkwasm_downsample";
inherit (finalAttrs) version;
hash = "sha256-tKkct5+39p5jM/vBj3RTSM1YZZoLnajh85Eon4/wavs=";
};
build-system = [
hatch-vcs
hatchling
];
nativeBuildInputs = [ writableTmpDirAsHomeHook ];
dependencies = [
itkwasm
itkwasm-downsample-emscripten
itkwasm-downsample-wasi
];
# No tests available
doCheck = false;
pythonImportsCheck = [ "itkwasm_downsample" ];
meta = {
description = "Pipelines for downsampling images";
homepage = "https://pypi.org/project/itkwasm-downsample";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fab ];
};
})
@@ -0,0 +1,39 @@
{
lib,
buildPythonPackage,
fetchPypi,
hatch-vcs,
hatchling,
itkwasm,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "itkwasm-image-io-emscripten";
version = "1.6.1";
pyproject = true;
src = fetchPypi {
pname = "itkwasm_image_io_emscripten";
inherit (finalAttrs) version;
hash = "sha256-lFYLpPM4LVSPANpKGg7WSYrrfvpmE2T1w4igidUUL3I=";
};
build-system = [
hatch-vcs
hatchling
];
nativeBuildInputs = [ writableTmpDirAsHomeHook ];
dependencies = [ itkwasm ];
pythonImportsCheck = [ "itkwasm_image_io_emscripten" ];
meta = {
description = "Input and output for scientific and medical image file formats";
homepage = "https://pypi.org/project/itkwasm-image-io-emscripten";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fab ];
};
})
@@ -0,0 +1,46 @@
{
lib,
buildPythonPackage,
fetchPypi,
hatch-vcs,
hatchling,
importlib-resources,
itkwasm,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "itkwasm-image-io-wasi";
version = "1.6.1";
pyproject = true;
src = fetchPypi {
pname = "itkwasm_image_io_wasi";
inherit (finalAttrs) version;
hash = "sha256-g3w/OPU9N1GxJkW9kKrOvGtVPRVb6zTy5n2nB5WU7+Q=";
};
build-system = [
hatch-vcs
hatchling
];
nativeBuildInputs = [ writableTmpDirAsHomeHook ];
dependencies = [
importlib-resources
itkwasm
];
pythonImportsCheck = [ "itkwasm_image_io_wasi" ];
# No tests available
doCheck = false;
meta = {
description = "Input and output for scientific and medical image file formats";
homepage = "https://pypi.org/project/itkwasm-image-io-wasi";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fab ];
};
})
@@ -0,0 +1,48 @@
{
lib,
buildPythonPackage,
fetchPypi,
hatch-vcs,
hatchling,
itkwasm,
itkwasm-image-io-emscripten,
itkwasm-image-io-wasi,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "itkwasm-image-io";
version = "1.6.1";
pyproject = true;
src = fetchPypi {
pname = "itkwasm_image_io";
inherit (finalAttrs) version;
hash = "sha256-Iwb6Xd+N3P+QsWhhu5q1Dx/joUClNgHBaWrgUalx0V4=";
};
build-system = [
hatch-vcs
hatchling
];
nativeBuildInputs = [ writableTmpDirAsHomeHook ];
dependencies = [
itkwasm
itkwasm-image-io-emscripten
itkwasm-image-io-wasi
];
pythonImportsCheck = [ "itkwasm_image_io" ];
# No tests available
doCheck = false;
meta = {
description = "Input and output for scientific and medical image file formats";
homepage = "https://pypi.org/project/itkwasm-image-io";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fab ];
};
})
@@ -0,0 +1,47 @@
{
lib,
buildPythonPackage,
fetchPypi,
hatchling,
importlib-metadata,
numpy,
platformdirs,
typing-extensions,
wasmtime,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "itkwasm";
version = "1.0b195";
pyproject = true;
src = fetchPypi {
inherit (finalAttrs) pname version;
hash = "sha256-1OQ0SieMEcrWiIgWT1dQxXdk9lCbWD+1xJ0jfIr0isU=";
};
build-system = [ hatchling ];
nativeBuildInputs = [ writableTmpDirAsHomeHook ];
dependencies = [
importlib-metadata
numpy
platformdirs
typing-extensions
wasmtime
];
# No test available
doCheck = false;
pythonImportsCheck = [ "itkwasm" ];
meta = {
description = "Python interface to itk-wasm WebAssembly (Wasm) modules";
homepage = "https://pypi.org/project/itkwasm";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fab ];
};
})
@@ -1,26 +1,23 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
hatchling,
dask-image,
dask,
fetchFromGitHub,
fsspec,
hatch-vcs,
hatchling,
ngff-zarr,
numpy,
python-dateutil,
spatial-image,
xarray,
writableTmpDirAsHomeHook,
xarray-dataclass,
xarray,
zarr,
dask-image,
fsspec,
jsonschema,
nbmake,
pooch,
pytestCheckHook,
pytest-mypy,
urllib3,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "multiscale-spatial-image";
version = "2.1.0";
pyproject = true;
@@ -28,14 +25,24 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "spatial-image";
repo = "multiscale-spatial-image";
tag = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-uF9ZccLvP1ref6qn3l6EpedsoK29Q8lAdr68JjsYMis=";
};
build-system = [ hatchling ];
pythonRelaxDeps = [
"dask"
"ngff-zarr"
"xarray"
];
build-system = [
hatch-vcs
hatchling
];
dependencies = [
dask
ngff-zarr
numpy
python-dateutil
spatial-image
@@ -49,20 +56,9 @@ buildPythonPackage rec {
#itk = [
# itk-filtering # not in nixpkgs yet
#];
test = [
dask-image
fsspec
#ipfsspec # not in nixpkgs
#itk-filtering # not in nixpkgs
jsonschema
nbmake
pooch
pytest-mypy
urllib3
];
};
nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.test;
nativeBuildInputs = [ writableTmpDirAsHomeHook ];
doCheck = false; # all test files try to download data
@@ -71,8 +67,8 @@ buildPythonPackage rec {
meta = {
description = "Generate a multiscale, chunked, multi-dimensional spatial image data structure that can serialized to OME-NGFF";
homepage = "https://github.com/spatial-image/multiscale-spatial-image";
changelog = "https://github.com/spatial-image/multiscale-spatial-image/releases/tag/${src.tag}";
changelog = "https://github.com/spatial-image/multiscale-spatial-image/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ bcdarwin ];
};
}
})
@@ -0,0 +1,142 @@
{
lib,
buildPythonPackage,
dask,
dask-image,
deepdiff,
fetchFromGitHub,
hatchling,
importlib-resources,
itk,
itkwasm-downsample,
itkwasm-image-io,
itkwasm,
jsonschema,
nibabel,
imageio,
numpy,
imagecodecs,
platformdirs,
pooch,
psutil,
pytestCheckHook,
rich-argparse,
rich,
tensorstore,
tifffile,
typing-extensions,
writableTmpDirAsHomeHook,
zarr,
}:
buildPythonPackage (finalAttrs: {
pname = "ngff-zarr";
version = "0.34.0";
pyproject = true;
src = fetchFromGitHub {
owner = "fideus-labs";
repo = "ngff-zarr";
tag = "py-v${finalAttrs.version}";
hash = "sha256-5OiC1NHVEX60oHPwTJ0RN2fQnitwPBMNSfvbMcKAgvc=";
};
sourceRoot = "${finalAttrs.src.name}/py/";
build-system = [ hatchling ];
dependencies = [
dask
importlib-resources
itkwasm
itkwasm-downsample
numpy
platformdirs
psutil
rich
rich-argparse
typing-extensions
zarr
]
++ dask.optional-dependencies.array;
optional-dependencies = {
dask-image = [ dask-image ];
# itk = [ itk-filtering ];
cli = [
# itk-filtering
# itk-io
# liffile
dask
dask-image
imagecodecs
imageio
itk
itkwasm-image-io
nibabel
tifffile
]
++ dask.optional-dependencies.distributed;
tensorstore = [ tensorstore ];
validate = [ jsonschema ];
};
nativeCheckInputs = [
deepdiff
pooch
pytestCheckHook
writableTmpDirAsHomeHook
]
++ lib.flatten (builtins.attrValues finalAttrs.passthru.optional-dependencies);
pythonImportsCheck = [ "ngff_zarr" ];
disabledTestPaths = [
# No CLI tests
"test/test_cli_input_to_ngff_image.py"
"test/test_cli_output.py"
"test/test_cli_relative_paths.py"
# Attribute errors
"test/test_pyramid_integrity.py"
"test/test_multiscales_type.py"
"test/test_convert_ome_zarr_version.py"
"test/test_itk_image_to_ngff_image.py"
# Data missing
"test/test_hcs.py"
"test/test_hcs_simple.py"
"test/test_ngff_validation.py"
"test/test_nibabel_image_to_ngff_image.py"
# Network access
"test/test_from_ngff_zarr_tensorstore.py"
"test/test_from_ngff_zarr.py"
"test/test_large_serialization.py"
"test/test_ngff_image_to_itk_image.py"
"test/test_omero.py"
"test/test_rfc9_ozx.py"
"test/test_to_ngff_zarr_dask_image.py"
"test/test_to_ngff_zarr_itk.py"
"test/test_to_ngff_zarr_itkwasm.py"
"test/test_to_ngff_zarr_rfc2_zarr_v3.py"
"test/test_to_ngff_zarr_sharding.py"
"test/test_to_ngff_zarr_tensorstore.py"
"test/test_to_ngff_zarr_v3_compression.py"
# Missing dependencies
"test/test_lif_to_ngff_image.py"
];
disabledTests = [
# Assertion errors
"test_2d_yx"
"test_3d_zyx"
"test_smaller_dask_graph"
"test_tensorstore_compression"
];
meta = {
description = "Open Microscopy Environment (OME) Next Generation File Format (NGFF) Zarr implementation";
homepage = "https://github.com/fideus-labs/ngff-zarr";
changelog = "https://github.com/fideus-labs/ngff-zarr/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.isc;
maintainers = with lib.maintainers; [ fab ];
};
})
@@ -0,0 +1,83 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
python,
pkgs,
pycparser,
pytest-mypy,
pytestCheckHook,
setuptools-git-versioning,
setuptools,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "wasmtime";
version = "44.0.0";
pyproject = true;
src = fetchFromGitHub {
owner = "bytecodealliance";
repo = "wasmtime-py";
tag = finalAttrs.version;
hash = "sha256-7K0j4jMsRB7/wNIj0pXxFTy0y7aN37wgCD1XKM92Ayw=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "setuptools-git-versioning>=2.0,<3" "setuptools-git-versioning" \
--replace-fail 'build-backend = "backend"' 'build-backend = "setuptools.build_meta"'
substituteInPlace ci/cbindgen.py \
--replace-fail "'-D__builtin_va_list=int'," "'-D__builtin_va_list=int', '-Dnullptr_t=void*',"
sed -i '/^backend-path = \[/,/^\]/d' pyproject.toml
# Use nixpkgs' wasmtime instead of downloading prebuilt C API artifacts.
mkdir -p wasmtime/linux-x86_64 wasmtime/linux-aarch64
ln -s ${lib.getLib pkgs.wasmtime}/lib/libwasmtime.so wasmtime/linux-x86_64/_libwasmtime.so
ln -s ${lib.getLib pkgs.wasmtime}/lib/libwasmtime.so wasmtime/linux-aarch64/_libwasmtime.so
'';
build-system = [
setuptools
setuptools-git-versioning
];
buildInputs = [ pkgs.wasmtime ];
postInstall = ''
# Ensure the installed module can find the shared library at runtime
mkdir -p "$out/${python.sitePackages}/wasmtime/linux-x86_64"
mkdir -p "$out/${python.sitePackages}/wasmtime/linux-aarch64"
ln -sf ${lib.getLib pkgs.wasmtime}/lib/libwasmtime.so "$out/${python.sitePackages}/wasmtime/linux-x86_64/_libwasmtime.so"
ln -sf ${lib.getLib pkgs.wasmtime}/lib/libwasmtime.so "$out/${python.sitePackages}/wasmtime/linux-aarch64/_libwasmtime.so"
'';
nativeCheckInputs = [
pycparser
pytest-mypy
pytestCheckHook
writableTmpDirAsHomeHook
];
disabledTestPaths = [
"ci/cbindgen.py"
];
pythonImportsCheck = [ "wasmtime" ];
preCheck = ''
# cbindgen.py checks bindings against C headers during test collection.
ln -s ${lib.getDev pkgs.wasmtime}/include wasmtime/include
'';
meta = {
description = "Python WebAssembly runtime powered by Wasmtime";
homepage = "https://github.com/bytecodealliance/wasmtime-py";
changelog = "https://github.com/bytecodealliance/wasmtime-py/releases/tag/{${finalAttrs.src.tag}}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ fab ];
};
})
+22
View File
@@ -7803,6 +7803,24 @@ self: super: with self; {
}
);
itkwasm = callPackage ../development/python-modules/itkwasm { };
itkwasm-downsample = callPackage ../development/python-modules/itkwasm-downsample { };
itkwasm-downsample-emscripten =
callPackage ../development/python-modules/itkwasm-downsample-emscripten
{ };
itkwasm-downsample-wasi = callPackage ../development/python-modules/itkwasm-downsample-wasi { };
itkwasm-image-io = callPackage ../development/python-modules/itkwasm-image-io { };
itkwasm-image-io-emscripten =
callPackage ../development/python-modules/itkwasm-image-io-emscripten
{ };
itkwasm-image-io-wasi = callPackage ../development/python-modules/itkwasm-image-io-wasi { };
itsdangerous = callPackage ../development/python-modules/itsdangerous { };
itunespy = callPackage ../development/python-modules/itunespy { };
@@ -11074,6 +11092,8 @@ self: super: with self; {
nftables = callPackage ../os-specific/linux/nftables/python.nix { inherit (pkgs) nftables; };
ngff-zarr = callPackage ../development/python-modules/ngff-zarr { };
nglview = callPackage ../development/python-modules/nglview { };
nh3 = callPackage ../development/python-modules/nh3 { };
@@ -21075,6 +21095,8 @@ self: super: with self; {
wasmerPackages = lib.recurseIntoAttrs (callPackage ../development/python-modules/wasmer { });
wasmtime = callPackage ../development/python-modules/wasmtime { };
wasserstein = callPackage ../development/python-modules/wasserstein { };
wassima = callPackage ../development/python-modules/wassima { };