python312Packages.nilearn: cleanup & fix (#382788)

This commit is contained in:
Gaétan Lepage
2025-02-17 15:07:34 +01:00
committed by GitHub
10 changed files with 251 additions and 110 deletions
@@ -0,0 +1,45 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pdm-backend,
importlib-resources,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "acres";
version = "0.2.0";
pyproject = true;
src = fetchFromGitHub {
owner = "nipreps";
repo = "acres";
tag = version;
hash = "sha256-DSDTOUNInLMR6C1P4NT+121sU+BYBLw67xRCtKobEaM=";
};
build-system = [
pdm-backend
];
dependencies = [
importlib-resources
];
pythonImportsCheck = [
"acres"
];
nativeCheckInputs = [
pytestCheckHook
];
meta = {
description = "Data-loading utility for Python";
homepage = "https://github.com/nipreps/acres";
changelog = "https://github.com/nipreps/acres/blob/${version}/CHANGELOG.md";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}
@@ -2,22 +2,20 @@
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
pytestCheckHook,
setuptools,
matplotlib,
pydicom,
python-dateutil,
setuptools,
pytestCheckHook,
versionCheckHook,
}:
let
deid-data = buildPythonPackage rec {
deid-data = buildPythonPackage {
pname = "deid-data";
version = "unstable-2022-12-06";
pyproject = true;
disabled = pythonOlder "3.7";
build-system = [ setuptools ];
dependencies = [ pydicom ];
@@ -39,18 +37,16 @@ let
in
buildPythonPackage rec {
pname = "deid";
version = "0.3.25";
version = "0.4.0";
pyproject = true;
disabled = pythonOlder "3.7";
# Pypi version has no tests
src = fetchFromGitHub {
owner = "pydicom";
repo = pname;
repo = "deid";
# the github repo does not contain Pypi version tags:
rev = "830966d52846c6b721fabb4cc1c75f39eabd55cc";
hash = "sha256-+slwnQSeRHpoCsvZ24Gq7rOBpQL37a6Iqrj4Mqj6PCo=";
rev = "14d1e4eb70f2c9fda43fca411794be9d8a5a8516";
hash = "sha256-YsLWHIO6whcBQriMYb0tDD9s/RrxlfeKGORF1UCOilI=";
};
build-system = [ setuptools ];
@@ -64,7 +60,9 @@ buildPythonPackage rec {
nativeCheckInputs = [
deid-data
pytestCheckHook
versionCheckHook
];
versionCheckProgramArg = [ "--version" ];
pythonImportsCheck = [ "deid" ];
@@ -2,16 +2,22 @@
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
pytestCheckHook,
# build-system
setuptools,
# dependencies
gdcm,
nibabel,
numpy,
pydicom,
scipy,
# tests
pillow,
pylibjpeg,
pylibjpeg-libjpeg,
scipy,
setuptools,
pytestCheckHook,
}:
buildPythonPackage rec {
@@ -19,8 +25,6 @@ buildPythonPackage rec {
version = "2.5.1";
pyproject = true;
disabled = pythonOlder "3.6";
# no tests in PyPI dist
src = fetchFromGitHub {
owner = "icometrix";
@@ -29,9 +33,14 @@ buildPythonPackage rec {
hash = "sha256-lPaBKqYO8B138fCgeKH6vpwGQhN3JCOnDj5PgaYfRPA=";
};
postPatch = ''
substituteInPlace tests/test_generic.py --replace-fail "from common" "from dicom2nifti.common"
substituteInPlace tests/test_ge.py --replace-fail "import convert_generic" "import dicom2nifti.convert_generic as convert_generic"
'';
build-system = [ setuptools ];
propagatedBuildInputs = [
dependencies = [
gdcm
nibabel
numpy
@@ -39,24 +48,37 @@ buildPythonPackage rec {
scipy
];
postPatch = ''
substituteInPlace tests/test_generic.py --replace-fail "from common" "from dicom2nifti.common"
substituteInPlace tests/test_ge.py --replace-fail "import convert_generic" "import dicom2nifti.convert_generic as convert_generic"
'';
nativeCheckInputs = [
pytestCheckHook
pylibjpeg
pylibjpeg-libjpeg
];
pythonImportsCheck = [ "dicom2nifti" ];
meta = with lib; {
nativeCheckInputs = [
pillow
pylibjpeg
pylibjpeg-libjpeg
pytestCheckHook
];
disabledTests = [
# OverflowError: Python integer -1024 out of bounds for uint16
"test_not_a_volume"
"test_resampling"
"test_validate_orthogonal_disabled"
# RuntimeError: Unable to decompress 'JPEG 2000 Image Compression (Lossless O...
"test_anatomical"
"test_compressed_j2k"
"test_main_function"
"test_rgb"
# Missing script 'dicom2nifti_scrip'
"test_gantry_option"
"test_gantry_resampling"
];
meta = {
homepage = "https://github.com/icometrix/dicom2nifti";
description = "Library for converting dicom files to nifti";
mainProgram = "dicom2nifti";
license = licenses.mit;
maintainers = with maintainers; [ bcdarwin ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ bcdarwin ];
};
}
@@ -1,19 +1,24 @@
{
lib,
buildPythonPackage,
fetchPypi,
pythonOlder,
pytestCheckHook,
fetchFromGitHub,
# build-system
hatch-vcs,
hatchling,
# dependencies
joblib,
lxml,
matplotlib,
nibabel,
numpy,
pandas,
requests,
scikit-learn,
scipy,
joblib,
requests,
packaging,
pytestCheckHook,
}:
buildPythonPackage rec {
@@ -21,36 +26,53 @@ buildPythonPackage rec {
version = "0.11.1";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit pname version;
hash = "sha256-oB3wj8bI3tPNb7eiEWNGA61Gpt94BQS20FIiwuepcv4=";
src = fetchFromGitHub {
owner = "nilearn";
repo = "nilearn";
tag = version;
hash = "sha256-ZvodSRJkKwPwpYHOLmxAYIIv7f9AlrjmZS9KLPjz5rM=";
};
nativeBuildInputs = [ hatch-vcs ];
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail " --template=maint_tools/templates/index.html" ""
'';
nativeCheckInputs = [ pytestCheckHook ];
disabledTests = [ "test_clean_confounds" ]; # https://github.com/nilearn/nilearn/issues/2608
# do subset of tests which don't fetch resources
pytestFlagsArray = [ "nilearn/connectome/tests" ];
build-system = [
hatch-vcs
hatchling
];
propagatedBuildInputs = [
dependencies = [
joblib
lxml
matplotlib
nibabel
numpy
pandas
requests
scikit-learn
scipy
packaging
];
meta = with lib; {
homepage = "https://nilearn.github.io";
nativeCheckInputs = [ pytestCheckHook ];
disabledTests = [
# https://github.com/nilearn/nilearn/issues/2608
"test_clean_confounds"
# [XPASS(strict)] invalid checks should fail
"test_check_estimator_invalid_group_sparse_covariance"
];
# do subset of tests which don't fetch resources
pytestFlagsArray = [ "nilearn/connectome/tests" ];
meta = {
description = "Module for statistical learning on neuroimaging data";
homepage = "https://nilearn.github.io";
changelog = "https://github.com/nilearn/nilearn/releases/tag/${version}";
license = licenses.bsd3;
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}
@@ -2,9 +2,13 @@
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
hatch-vcs,
hatchling,
pytestCheckHook,
# dependencies
acres,
attrs,
importlib-resources,
jinja2,
@@ -26,18 +30,24 @@
templateflow,
traits,
transforms3d,
# tests
pytest-cov-stub,
pytest-env,
pytestCheckHook,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
pname = "niworkflows";
version = "1.12.0";
version = "1.12.2";
pyproject = true;
src = fetchFromGitHub {
owner = "nipreps";
repo = "niworkflows";
tag = version;
hash = "sha256-OWsfz5YDPy1qPpXomr4YiuCDf40Fy1pW8cNHPjHfqp4=";
hash = "sha256-rgnfp12SHlL3LFFMSrHlTd0tWNnA4ekxZ9kKYRvZWlw=";
};
pythonRelaxDeps = [ "traits" ];
@@ -48,6 +58,7 @@ buildPythonPackage rec {
];
dependencies = [
acres
attrs
importlib-resources
jinja2
@@ -73,29 +84,38 @@ buildPythonPackage rec {
env.SETUPTOOLS_SCM_PRETEND_VERSION = version;
nativeCheckInputs = [ pytestCheckHook ];
preCheck = ''export HOME=$(mktemp -d)'';
nativeCheckInputs = [
pytest-cov-stub
pytest-env
pytestCheckHook
writableTmpDirAsHomeHook
];
pytestFlagsArray = [ "niworkflows" ];
# try to download data:
disabledTests = [
"test_GenerateCifti"
# try to download data:
"ROIsPlot"
"ROIsPlot2"
"niworkflows.interfaces.cifti._prepare_cifti"
"niworkflows.utils.misc.get_template_specs"
"test_GenerateCifti"
"test_SimpleShowMaskRPT"
"test_cifti_surfaces_plot"
"niworkflows.utils.misc.get_template_specs"
"niworkflows.interfaces.cifti._prepare_cifti"
];
disabledTestPaths = [ "niworkflows/tests/test_registration.py" ];
disabledTestPaths = [
"niworkflows/tests/test_registration.py"
];
pythonImportsCheck = [ "niworkflows" ];
meta = with lib; {
meta = {
description = "Common workflows for MRI (anatomical, functional, diffusion, etc.)";
mainProgram = "niworkflows-boldref";
homepage = "https://github.com/nipreps/niworkflows";
changelog = "https://github.com/nipreps/niworkflows/blob/${src.tag}/CHANGES.rst";
license = licenses.asl20;
maintainers = with maintainers; [ bcdarwin ];
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ bcdarwin ];
};
}
@@ -3,13 +3,18 @@
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
pythonOlder,
pytest7CheckHook,
# build-system
poetry-core,
# dependencies
jsonschema,
numpy,
pydicom,
simpleitk,
# tests
pytestCheckHook,
}:
buildPythonPackage rec {
@@ -17,14 +22,12 @@ buildPythonPackage rec {
version = "0.4.1";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "razorx89";
repo = pname;
repo = "pydicom-seg";
tag = "v${version}";
hash = "sha256-2Y3fZHKfZqdp5EU8HfVsmJ5JFfVGZuAR7+Kj7qaTiPM=";
fetchSubmodules = true;
hash = "sha256-2Y3fZHKfZqdp5EU8HfVsmJ5JFfVGZuAR7+Kj7qaTiPM=";
};
patches = [
@@ -36,7 +39,10 @@ buildPythonPackage rec {
})
];
pythonRelaxDeps = [ "jsonschema" ];
pythonRelaxDeps = [
"jsonschema"
"numpy"
];
build-system = [ poetry-core ];
@@ -47,15 +53,17 @@ buildPythonPackage rec {
simpleitk
];
nativeCheckInputs = [ pytest7CheckHook ];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "pydicom_seg" ];
meta = with lib; {
meta = {
description = "Medical segmentation file reading and writing";
homepage = "https://github.com/razorx89/pydicom-seg";
changelog = "https://github.com/razorx89/pydicom-seg/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ bcdarwin ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ bcdarwin ];
# ModuleNotFoundError: No module named 'pydicom._storage_sopclass_uids'
broken = true;
};
}
@@ -3,7 +3,6 @@
stdenv,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
flit-core,
numpy,
pytestCheckHook,
@@ -11,8 +10,8 @@
# optional/test dependencies
gdcm,
pillow,
pylibjpeg,
pylibjpeg-libjpeg,
writableTmpDirAsHomeHook,
}:
let
# Pydicom needs pydicom-data to run some tests. If these files aren't downloaded
@@ -29,8 +28,6 @@ buildPythonPackage rec {
version = "3.0.1";
pyproject = true;
disabled = pythonOlder "3.10";
src = fetchFromGitHub {
owner = "pydicom";
repo = "pydicom";
@@ -55,13 +52,15 @@ buildPythonPackage rec {
];
};
nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.pixeldata;
nativeCheckInputs = [
pytestCheckHook
writableTmpDirAsHomeHook
] ++ optional-dependencies.pixeldata;
# Setting $HOME to prevent pytest to try to create a folder inside
# /homeless-shelter which is read-only.
# Linking pydicom-data dicom files to $HOME/.pydicom/data
preCheck = ''
export HOME=$TMP/test-home
mkdir -p $HOME/.pydicom/
ln -s ${test_data}/data_store/data $HOME/.pydicom/data
'';
@@ -90,12 +89,20 @@ buildPythonPackage rec {
pythonImportsCheck = [ "pydicom" ];
meta = with lib; {
meta = {
description = "Python package for working with DICOM files";
mainProgram = "pydicom";
homepage = "https://pydicom.github.io";
changelog = "https://github.com/pydicom/pydicom/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ bcdarwin ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ bcdarwin ];
badPlatforms = [
# > 200 tests are failing with errors like:
# AttributeError: 'FileDataset' object has no attribute 'BitsStored'
# AttributeError: 'FileDataset' object has no attribute 'Rows'
# AttributeError: The dataset has no 'Pixel Data', 'Float Pixel Data' or 'Double Float Pixel Data' element, no pixel data to decode
# pydicom.errors.InvalidDicomError: File is missing DICOM File Meta Information header or the 'DICM' prefix is missing from the header.
lib.systems.inspect.patterns.isDarwin
];
};
}
@@ -2,7 +2,6 @@
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
poetry-core,
httpx,
pydicom,
@@ -10,20 +9,23 @@
buildPythonPackage rec {
pname = "pyorthanc";
version = "1.19.0";
disabled = pythonOlder "3.8";
version = "1.19.1";
pyproject = true;
src = fetchFromGitHub {
owner = "gacou54";
repo = pname;
repo = "pyorthanc";
tag = "v${version}";
hash = "sha256-6//kmkurtaXRGvnYnk/kU2j9F6V1Aui6IEdl+3DHGH0=";
hash = "sha256-97i341NXb7QsgN0X808mtz1rSKYSP+SMoGJy43Tkwug=";
};
build-system = [ poetry-core ];
pythonRelaxDeps = [
"pydicom"
];
dependencies = [
httpx
pydicom
@@ -33,11 +35,11 @@ buildPythonPackage rec {
pythonImportsCheck = [ "pyorthanc" ];
meta = with lib; {
meta = {
description = "Python library that wraps the Orthanc REST API";
homepage = "https://github.com/gacou54/pyorthanc";
changelog = "https://github.com/gacou54/pyorthanc/releases/tag/${src.tag}";
license = licenses.mit;
maintainers = with maintainers; [ bcdarwin ];
changelog = "https://github.com/gacou54/pyorthanc/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ bcdarwin ];
};
}
@@ -1,42 +1,54 @@
{
stdenv,
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,
# build-system
hatchling,
# dependencies
deprecated,
humanize,
matplotlib,
nibabel,
numpy,
parameterized,
packaging,
rich,
scipy,
simpleitk,
torch,
tqdm,
typer,
# tests
humanize,
parameterized,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "torchio";
version = "0.20.3";
version = "0.20.4";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "fepegar";
repo = "torchio";
tag = "v${version}";
hash = "sha256-I91KcrCwHkjY7oh5RFWfV93pRgd4iQVCBVTtd4TqXGo=";
hash = "sha256-pcUc0pnpb3qQLMOYU9yh7cljyCQ+Ngf8fJDcrRrK8LQ=";
};
propagatedBuildInputs = [
build-system = [
hatchling
];
dependencies = [
deprecated
humanize
nibabel
numpy
packaging
rich
scipy
simpleitk
torch
@@ -45,10 +57,11 @@ buildPythonPackage rec {
];
nativeCheckInputs = [
pytestCheckHook
matplotlib
parameterized
pytestCheckHook
];
disabledTests =
[
# tries to download models:
@@ -58,15 +71,17 @@ buildPythonPackage rec {
# RuntimeError: DataLoader worker (pid(s) <...>) exited unexpectedly
"test_queue_multiprocessing"
];
pythonImportsCheck = [
"torchio"
"torchio.data"
];
meta = with lib; {
meta = {
description = "Medical imaging toolkit for deep learning";
homepage = "https://torchio.readthedocs.io";
license = licenses.asl20;
maintainers = [ maintainers.bcdarwin ];
changelog = "https://github.com/TorchIO-project/torchio/blob/v${version}/CHANGELOG.md";
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.bcdarwin ];
};
}
+2
View File
@@ -51,6 +51,8 @@ self: super: with self; {
acquire = callPackage ../development/python-modules/acquire { };
acres = callPackage ../development/python-modules/acres { };
actdiag = callPackage ../development/python-modules/actdiag { };
acunetix = callPackage ../development/python-modules/acunetix { };