diff --git a/pkgs/by-name/un/units-llnl/package.nix b/pkgs/by-name/un/units-llnl/package.nix new file mode 100644 index 000000000000..fcba27fb936c --- /dev/null +++ b/pkgs/by-name/un/units-llnl/package.nix @@ -0,0 +1,42 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + + # This is the baseType needed by scipp - the main package that depends on + # this package. + baseType ? "uint64_t", +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "units-llnl"; + version = "0.13.1"; + + src = fetchFromGitHub { + owner = "LLNL"; + repo = "units"; + tag = "v${finalAttrs.version}"; + hash = "sha256-thJnBT+wQPF9obzXk/T6H9lvPEAH5REx3YhBXEd7n7c="; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + cmake + ]; + cmakeFlags = [ + (lib.cmakeBool "BUILD_SHARED_LIBS" true) + (lib.cmakeFeature "UNITS_BASE_TYPE" baseType) + ]; + doCheck = true; + + meta = { + description = "Run-time C++ library for working with units of measurement and conversions between them and with string representations of units and measurements"; + homepage = "https://github.com/llnl/units"; + changelog = "https://github.com/llnl/units/blob/${finalAttrs.src.tag}/CHANGELOG.md"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ doronbehar ]; + mainProgram = "units-llnl"; + platforms = lib.platforms.all; + }; +}) diff --git a/pkgs/development/python-modules/mpltoolbox/default.nix b/pkgs/development/python-modules/mpltoolbox/default.nix new file mode 100644 index 000000000000..ddada447daf3 --- /dev/null +++ b/pkgs/development/python-modules/mpltoolbox/default.nix @@ -0,0 +1,52 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + setuptools-scm, + + # tests + matplotlib, + ipympl, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "mpltoolbox"; + version = "25.04.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "scipp"; + repo = "mpltoolbox"; + tag = version; + hash = "sha256-+LqPTlVbSxuewWuPNUfGdgQjWFxo7s2i3e21WkNNK78="; + }; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + matplotlib + ]; + + nativeCheckInputs = [ + ipympl + pytestCheckHook + ]; + + pythonImportsCheck = [ + "mpltoolbox" + ]; + + meta = { + description = "Interactive tools for Matplotlib"; + homepage = "https://scipp.github.io/mpltoolbox/"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ doronbehar ]; + }; +} diff --git a/pkgs/development/python-modules/plopp/default.nix b/pkgs/development/python-modules/plopp/default.nix new file mode 100644 index 000000000000..581dbb51e5d2 --- /dev/null +++ b/pkgs/development/python-modules/plopp/default.nix @@ -0,0 +1,117 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + setuptools-scm, + + # dependencies + lazy-loader, + matplotlib, + + # tests + pytestCheckHook, + anywidget, + graphviz, + h5py, + ipympl, + ipywidgets, + mpltoolbox, + pandas, + plotly, + pooch, + pyarrow, + pythreejs, + scipp, + scipy, + xarray, + + # tests data + symlinkJoin, + fetchurl, +}: + +buildPythonPackage rec { + pname = "plopp"; + version = "25.06.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "scipp"; + repo = "plopp"; + tag = version; + hash = "sha256-SwF0bUU/DAAJ5+0WvZgwqEw6IoaqdbKj0GkCgffGclA="; + }; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + lazy-loader + matplotlib + ]; + + nativeCheckInputs = [ + pytestCheckHook + anywidget + graphviz + h5py + ipympl + ipywidgets + mpltoolbox + pandas + plotly + pooch + pyarrow + pythreejs + scipp + scipy + xarray + ]; + + env = { + # See: https://github.com/scipp/plopp/blob/25.05.0/src/plopp/data/examples.py + PLOPP_DATA_DIR = + let + # NOTE this might be changed by upstream in the future. + _version = "1"; + in + symlinkJoin { + name = "plopp-test-data"; + paths = + lib.mapAttrsToList + ( + file: hash: + fetchurl { + url = "https://public.esss.dk/groups/scipp/plopp/${_version}/${file}"; + inherit hash; + downloadToTemp = true; + recursiveHash = true; + postFetch = '' + mkdir -p $out/${_version} + mv $downloadedFile $out/${_version}/${file} + ''; + } + ) + { + "nyc_taxi_data.h5" = "sha256-hso8ESM+uLRf4y2CW/7dpAmm/kysAfJY3b+5vz78w4Q="; + "teapot.h5" = "sha256-i6hOw72ce1cBT6FMQTdCEKVe0WOMOjApKperGHoPW34="; + }; + }; + }; + + pythonImportsCheck = [ + "plopp" + ]; + + meta = { + description = "Visualization library for scipp"; + homepage = "https://scipp.github.io/plopp/"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ doronbehar ]; + }; +} diff --git a/pkgs/development/python-modules/scipp/default.nix b/pkgs/development/python-modules/scipp/default.nix new file mode 100644 index 000000000000..9cfb79fe914a --- /dev/null +++ b/pkgs/development/python-modules/scipp/default.nix @@ -0,0 +1,114 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + + # build-system + scikit-build-core, + setuptools, + setuptools-scm, + + # nativeBuildInputs + cmake, + ninja, + + # dependencies + numpy, + units-llnl, + + # buildInputs + boost, + eigen, + gtest, + pybind11, + tbb_2022_0, + + # tests + pytestCheckHook, + scipy, + beautifulsoup4, + ipython, + matplotlib, + pandas, + numba, + xarray, + h5py, + hypothesis, +}: + +buildPythonPackage rec { + pname = "scipp"; + version = "25.05.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "scipp"; + repo = "Scipp"; + # https://github.com/scipp/scipp/pull/3722 + tag = version; + hash = "sha256-AanXb+nF/YIZFuzG5UnoNPX97WScfPKuoSBY18uYt9k="; + }; + env = { + SKIP_CONAN = "true"; + }; + + build-system = [ + scikit-build-core + setuptools + setuptools-scm + ]; + + nativeBuildInputs = [ + cmake + ninja + ]; + dontUseCmakeConfigure = true; + + dependencies = [ + numpy + ]; + + buildInputs = [ + boost + eigen + gtest + pybind11 + units-llnl.passthru.top-level + tbb_2022_0 + ]; + + nativeCheckInputs = [ + pytestCheckHook + scipy + beautifulsoup4 + ipython + matplotlib + pandas + numba + xarray + h5py + hypothesis + ]; + pytestFlagsArray = [ + # See https://github.com/scipp/scipp/issues/3721 + "--hypothesis-profile=ci" + ]; + + pythonImportsCheck = [ + "scipp" + ]; + + meta = { + description = "Multi-dimensional data arrays with labeled dimensions"; + homepage = "https://scipp.github.io"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ doronbehar ]; + # Got: + # + # error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw] + # + # Needs debugging along with upstream. + broken = stdenv.hostPlatform.isDarwin; + }; +} diff --git a/pkgs/development/python-modules/units-llnl/default.nix b/pkgs/development/python-modules/units-llnl/default.nix new file mode 100644 index 000000000000..03d0cfda1515 --- /dev/null +++ b/pkgs/development/python-modules/units-llnl/default.nix @@ -0,0 +1,56 @@ +{ + lib, + buildPythonPackage, + units-llnl, + + # build-system + nanobind, + scikit-build-core, + + # nativeBuildInputs + cmake, + # NOTE that if top-level units-llnl package uses cmakeFlags other then + # Nixpkgs' default, the build might fail, and you'd want to pick only the + # cmakeFlags that don't cause a failure. See also: + # https://github.com/scipp/scipp/issues/3705 + cmakeFlags ? units-llnl.cmakeFlags, + ninja, +}: + +buildPythonPackage { + inherit (units-llnl) + pname + version + src + meta + ; + pyproject = true; + + build-system = [ + nanobind + scikit-build-core + ]; + + nativeBuildInputs = [ + cmake + ninja + ]; + dontUseCmakeConfigure = true; + env = { + SKBUILD_CMAKE_ARGS = lib.strings.concatStringsSep ";" ( + cmakeFlags + ++ [ + (lib.cmakeBool "UNITS_BUILD_PYTHON_LIBRARY" true) + ] + ); + }; + + # Also upstream turns off testing for the python build so it seems, see: + # https://github.com/LLNL/units/blob/v0.13.1/pyproject.toml#L65-L66 However + # they do seem to use pytest for their CI, but in our case it fails due to + # missing googletest Python modules, which we don't know how to build. + doCheck = false; + passthru = { + top-level = units-llnl; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 35539f3ee485..5904d0e75cfc 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9369,6 +9369,8 @@ self: super: with self; { mplleaflet = callPackage ../development/python-modules/mplleaflet { }; + mpltoolbox = callPackage ../development/python-modules/mpltoolbox { }; + mpmath = callPackage ../development/python-modules/mpmath { }; mpris-server = callPackage ../development/python-modules/mpris-server { }; @@ -11518,6 +11520,8 @@ self: super: with self; { ploomber-extension = callPackage ../development/python-modules/ploomber-extension { }; + plopp = callPackage ../development/python-modules/plopp { }; + plotext = callPackage ../development/python-modules/plotext { }; plotille = callPackage ../development/python-modules/plotille { }; @@ -15829,6 +15833,8 @@ self: super: with self; { scim2-tester = callPackage ../development/python-modules/scim2-tester { }; + scipp = callPackage ../development/python-modules/scipp { }; + scipy = callPackage ../development/python-modules/scipy { }; scmrepo = callPackage ../development/python-modules/scmrepo { }; @@ -18748,6 +18754,10 @@ self: super: with self; { unique-log-filter = callPackage ../development/python-modules/unique-log-filter { }; + units-llnl = callPackage ../development/python-modules/units-llnl { + inherit (pkgs) units-llnl; + }; + unittest-data-provider = callPackage ../development/python-modules/unittest-data-provider { }; unittest-xml-reporting = callPackage ../development/python-modules/unittest-xml-reporting { };