Files
nixpkgs/pkgs/development/python-modules/fastmri/default.nix
T

91 lines
1.8 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
pythonAtLeast,
# build system
setuptools,
setuptools-scm,
# dependencies
numpy,
scikit-image,
torchvision,
torch,
runstats,
pytorch-lightning,
h5py,
pyyaml,
torchmetrics,
pandas,
# tests
pytestCheckHook,
}:
buildPythonPackage (finalAttrs: {
pname = "fastmri";
version = "0.3.0";
pyproject = true;
src = fetchFromGitHub {
owner = "facebookresearch";
repo = "fastMRI";
tag = "v${finalAttrs.version}";
hash = "sha256-0IJV8OhY5kPWQwUYPKfmdI67TyYzDAPlwohdc0jWcV4=";
};
# banding_removal folder also has a subfolder named "fastmri"
# and np.product is substituted with np.prod in new numpy versions
postPatch = ''
substituteInPlace tests/test_math.py \
--replace-fail "np.product" "np.prod"
substituteInPlace tests/conftest.py \
--replace-fail "np.product" "np.prod"
rm -rf banding_removal
'';
build-system = [
setuptools
setuptools-scm
];
dependencies = [
numpy
scikit-image
torchvision
torch
runstats
pytorch-lightning
h5py
pyyaml
torchmetrics
pandas
];
nativeCheckInputs = [ pytestCheckHook ];
disabledTests = lib.optionals (pythonAtLeast "3.14") [
# AttributeError: '...' object has no attribute '__annotations__'.
"test_unet_scripting"
"test_varnet_scripting"
];
disabledTestPaths = [
# much older version of pytorch-lightning is used
"tests/test_modules.py"
];
pythonImportsCheck = [ "fastmri" ];
meta = {
description = "Pytorch-based MRI reconstruction tooling";
homepage = "https://github.com/facebookresearch/fastMRI";
changelog = "https://github.com/facebookresearch/fastMRI/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ osbm ];
};
})