From 3ef8e1eaa750a109911fa851a8a414be6eaa32cd Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 23 Jun 2026 01:17:16 +0300 Subject: [PATCH] python3Packages.scippneutron: init at 26.6.0 --- .../python-modules/scippneutron/default.nix | 163 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 165 insertions(+) create mode 100644 pkgs/development/python-modules/scippneutron/default.nix diff --git a/pkgs/development/python-modules/scippneutron/default.nix b/pkgs/development/python-modules/scippneutron/default.nix new file mode 100644 index 000000000000..67379dc882ad --- /dev/null +++ b/pkgs/development/python-modules/scippneutron/default.nix @@ -0,0 +1,163 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + setuptools-scm, + + # dependencies + email-validator, + h5py, + lazy-loader, + mpltoolbox, + numpy, + plopp, + pydantic, + python-dateutil, + scipp, + scippnexus, + scipy, + + # tests + pytestCheckHook, + pooch, + hypothesis, + ipykernel, + ipympl, + psutil, + pytest-xdist, + pythreejs, + sciline, + stdenvNoCC, + curl, + cacert, +}: + +buildPythonPackage (finalAttrs: { + pname = "scippneutron"; + version = "26.6.0"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "scipp"; + repo = "scippneutron"; + tag = finalAttrs.version; + hash = "sha256-ZhQVOUX2LcoLtAvAos7CWfVHKfqIWtIsXeYAPbUZTV0="; + }; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + email-validator + h5py + lazy-loader + mpltoolbox + numpy + plopp + pydantic + python-dateutil + scipp + scippnexus + scipy + ]; + + nativeCheckInputs = [ + pytestCheckHook + hypothesis + ipykernel + ipympl + pooch + psutil + pytest-xdist + pythreejs + sciline + ]; + + env = { + # See: https://github.com/scipp/scippneutron/blob/26.6.0/src/scippneutron/data/__init__.py + SCIPPNEUTRON_DATA_DIR = + let + # NOTE this might be changed by upstream in the future. + _version = "5"; + in + stdenvNoCC.mkDerivation { + name = "plopp-test-data"; + dontUnpack = true; + strictDeps = true; + __structuredAttrs = true; + nativeBuildInputs = [ + curl + ]; + configurePhase = '' + curlVersion=$(curl -V | head -1 | cut -d' ' -f2) + curl=( + curl + --location + --max-redirs 20 + --retry 3 + --retry-all-errors + --continue-at - + --disable-epsv + --cookie-jar cookies + --user-agent "curl/$curlVersion Nixpkgs" + ) + export SSL_CERT_FILE="${cacert}/etc/ssl/certs/ca-bundle.crt" + mkdir -p $out/${_version} + ''; + buildPhase = + lib.pipe + [ + "iris26176_graphite002_sqw.nxs" + "loki-at-larmor.hdf5" + "loki-at-larmor-filtered.hdf5" + "powder-event.h5" + "powder-event-filtered.h5" + "mcstas_sans.h5" + "CNCS_51936_event.nxs" + "GEM40979.raw" + "PG3_4844_calibration.h5" + "PG3_4844_event.nxs" + "PG3_4866_event.nxs" + "PG3_4871_event.nxs" + "WISH00016748.raw" + "horace_sqw_4d.sqw" + "dream_geant4_data.h5" + ] + [ + (map ( + f: + "curl \"https://public.esss.dk/groups/scipp/scippneutron/${_version}/${f}\" --output \"$out/${_version}/${f}\"" + )) + (lib.concatStringsSep "\n") + ]; + dontInstall = true; + dontFixup = true; + outputHash = "sha256-UxFphegP2VdQ7zMssAf8FQbrQqOr4+qVjcIugxz0ZxA="; + outputHashMode = "recursive"; + }; + }; + + # See . From some reason + # the whole file has to be deleted, otherwise the tests are not disabled. + preCheck = '' + rm tests/masking_tool_test.py + ''; + + pythonImportsCheck = [ + "scippneutron" + ]; + + meta = { + description = "Neutron scattering toolkit built using scipp for Data Reduction. Not facility or instrument specific"; + homepage = "https://scipp.github.io/scippneutron"; + changelog = "https://github.com/scipp/scippneutron/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ doronbehar ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 90272aca7ec7..64991aab42d8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -17782,6 +17782,8 @@ self: super: with self; { scipp = callPackage ../development/python-modules/scipp { }; + scippneutron = callPackage ../development/python-modules/scippneutron { }; + scippnexus = callPackage ../development/python-modules/scippnexus { }; scipy = callPackage ../development/python-modules/scipy { };