2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
2024-10-11 05:15:48 +00:00
|
|
|
fetchFromGitHub,
|
|
|
|
fetchNpmDeps,
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonOlder,
|
2024-10-11 05:15:48 +00:00
|
|
|
nodejs,
|
|
|
|
npmHooks,
|
2024-06-05 15:53:02 +00:00
|
|
|
hatchling,
|
|
|
|
hatch-vcs,
|
|
|
|
anywidget,
|
|
|
|
pytestCheckHook,
|
2023-05-24 13:37:59 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "ipyniivue";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2.0.1";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "niivue";
|
|
|
|
repo = "ipyniivue";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-6DZmHVVxJspjUhJ9pzTmTvwAnQfvTp8OL2xZONz2XbU=";
|
|
|
|
};
|
|
|
|
|
|
|
|
npmDeps = fetchNpmDeps {
|
|
|
|
name = "${pname}-${version}-npm-deps";
|
|
|
|
inherit src;
|
|
|
|
hash = "sha256-ZJRBGMNn5clxMavimfl6Jwqf7M2pRo+WLne0gUWOiJ8=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
# We do not need the build hooks, because we do not need to
|
2023-10-09 19:29:22 +00:00
|
|
|
# build any JS components; these are present already in the PyPI artifact.
|
2024-04-21 15:54:59 +00:00
|
|
|
env.HATCH_BUILD_NO_HOOKS = true;
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
nodejs
|
|
|
|
npmHooks.npmConfigHook
|
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
npm run build
|
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
build-system = [
|
2023-10-09 19:29:22 +00:00
|
|
|
hatchling
|
2024-05-15 15:35:15 +00:00
|
|
|
hatch-vcs
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
dependencies = [ anywidget ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2023-05-24 13:37:59 +00:00
|
|
|
pythonImportsCheck = [ "ipyniivue" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Show a nifti image in a webgl 2.0 canvas within a jupyter notebook cell";
|
|
|
|
homepage = "https://github.com/niivue/ipyniivue";
|
|
|
|
changelog = "https://github.com/niivue/ipyniivue/releases/tag/${version}";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|