depot/third_party/nixpkgs/pkgs/development/python-modules/ipyniivue/default.nix
Default email ae2dc6aea6 Project import generated by Copybara.
GitOrigin-RevId: 4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0
2024-10-11 07:15:48 +02:00

65 lines
1.4 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
fetchNpmDeps,
pythonOlder,
nodejs,
npmHooks,
hatchling,
hatch-vcs,
anywidget,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "ipyniivue";
version = "2.0.1";
pyproject = true;
disabled = pythonOlder "3.7";
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=";
};
# We do not need the build hooks, because we do not need to
# build any JS components; these are present already in the PyPI artifact.
env.HATCH_BUILD_NO_HOOKS = true;
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
preBuild = ''
npm run build
'';
build-system = [
hatchling
hatch-vcs
];
dependencies = [ anywidget ];
nativeCheckInputs = [ pytestCheckHook ];
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 ];
};
}