Unverified Commit 57ea8336 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python3Packages.pyinterp: init at 2025.8.1 (#437926)

parents 91f1d824 2fc384a4
Loading
Loading
Loading
Loading
+106 −0
Original line number Diff line number Diff line
{
  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 ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -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 { };