diff --git a/pkgs/development/python-modules/pyinterp/default.nix b/pkgs/development/python-modules/pyinterp/default.nix new file mode 100644 index 000000000000..b3a162ef1f93 --- /dev/null +++ b/pkgs/development/python-modules/pyinterp/default.nix @@ -0,0 +1,106 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + + # buildInputs + boost, + blas, + eigen, + gtest, + pybind11, + + # build-system + cmake, + setuptools, + + # dependencies + dask, + numpy, + xarray, + + # tests + pytestCheckHook, +}: +buildPythonPackage rec { + pname = "pyinterp"; + version = "2025.8.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "CNES"; + repo = "pangeo-pyinterp"; + tag = version; + hash = "sha256-9DZIPiqt0JbadeGIkVrg+XuPu4XfVlHm36sBKZ2G7ww="; + }; + + # Remove the git submodule link to pybind11, patch setup.py build backend and version information + postPatch = '' + rm -rf third_party/pybind11 + mkdir -p third_party + ln -sr ${pybind11.src} third_party/pybind11 + + substituteInPlace pyproject.toml --replace-fail 'build-backend = "backend"' 'build-backend = "setuptools.build_meta"' + substituteInPlace pyproject.toml --replace-fail 'backend-path = ["_custom_build"]' "" + + substituteInPlace setup.py \ + --replace-fail 'version=revision(),' 'version="${version}",' + + substituteInPlace src/pyinterp/__init__.py \ + --replace-fail 'from . import geodetic, geohash, version' 'from . import geodetic, geohash' \ + --replace-fail '__version__ = version.release()' '__version__ = "${version}"' \ + --replace-fail '__date__ = version.date()' '__date__ = "${version}"' \ + --replace-fail 'del version' "" + ''; + + dontUseCmakeConfigure = true; + + buildInputs = [ + blas + boost + eigen + gtest + pybind11 + ]; + + build-system = [ + cmake + setuptools + ]; + + dependencies = [ + dask + numpy + xarray + ]; + + pythonImportsCheck = [ + "pyinterp" + "pyinterp.geohash" + ]; + + disabledTests = [ + # segmentation fault + "test_bounding_box" + "test_geohash" + "test_encoding" + "test_neighbors" + ] + ++ lib.optionals stdenv.hostPlatform.isAarch64 [ + # AssertionError, probably floating point precision differences + "test_quadrivariate" + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = { + description = "Python library for optimized geo-referenced interpolation"; + homepage = "https://github.com/CNES/pangeo-pyinterp"; + changelog = "https://github.com/CNES/pangeo-pyinterp/releases/tag/${src.tag}"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ daspk04 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e722cfc7ae0c..7ff57d1c0553 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13116,6 +13116,8 @@ self: super: with self; { pyinstrument = callPackage ../development/python-modules/pyinstrument { }; + pyinterp = callPackage ../development/python-modules/pyinterp { }; + pyintesishome = callPackage ../development/python-modules/pyintesishome { }; pyipma = callPackage ../development/python-modules/pyipma { };