Commit 1f3c889f authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files
parent b736a8a8
Loading
Loading
Loading
Loading
+4 −15
Original line number Diff line number Diff line
@@ -2,9 +2,7 @@
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, fetchpatch
, setuptools
, pybind11
, numpy
, pytestCheckHook
, absl-py
@@ -12,8 +10,8 @@

buildPythonPackage rec {
  pname = "ml-dtypes";
  version = "0.3.1";
  format = "pyproject";
  version = "0.3.2";
  pyproject = true;

  disabled = pythonOlder "3.9";

@@ -21,33 +19,23 @@ buildPythonPackage rec {
    owner = "jax-ml";
    repo = "ml_dtypes";
    rev = "refs/tags/v${version}";
    hash = "sha256-tuqB5itrAkT2b76rgRAJaOeng4V83TzPu400DPYrdKU=";
    hash = "sha256-epWunA5FULmCuTABl3uckFuNaSEpqJxtp0n0loCb6Q0=";
    # Since this upstream patch (https://github.com/jax-ml/ml_dtypes/commit/1bfd097e794413b0d465fa34f2eff0f3828ff521),
    # the attempts to use the nixpkgs packaged eigen dependency have failed.
    # Hence, we rely on the bundled eigen library.
    fetchSubmodules = true;
  };

  patches = [
    # See https://github.com/jax-ml/ml_dtypes/issues/106.
    (fetchpatch {
      url = "https://github.com/jax-ml/ml_dtypes/commit/c082a2df6bc0686b35c4b4a303fd1990485e181f.patch";
      hash = "sha256-aVJy9vT00b98xOrJCdbCHSZBI3uyjafmN88Z2rjBS48=";
    })
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace "numpy~=1.21.2" "numpy" \
      --replace "numpy~=1.23.3" "numpy" \
      --replace "numpy~=1.26.0" "numpy" \
      --replace "pybind11~=2.11.1" "pybind11" \
      --replace "setuptools~=68.1.0" "setuptools"
  '';

  nativeBuildInputs = [
    setuptools
    pybind11
  ];

  propagatedBuildInputs = [
@@ -72,6 +60,7 @@ buildPythonPackage rec {
  meta = with lib; {
    description = "A stand-alone implementation of several NumPy dtype extensions used in machine learning libraries";
    homepage = "https://github.com/jax-ml/ml_dtypes";
    changelog = "https://github.com/jax-ml/ml_dtypes/releases/tag/v${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ GaetanLepage samuela ];
  };