Commit 8719eb45 authored by Robert Schütz's avatar Robert Schütz
Browse files
parent c819a6d5
Loading
Loading
Loading
Loading
+25 −14
Original line number Diff line number Diff line
@@ -3,33 +3,41 @@
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  cython_0,
  cython,
  hypothesis,
  numpy,
  pytestCheckHook,
  pythonOlder,
  blis,
  numpy_2,
  gitUpdater,
}:

buildPythonPackage rec {
  pname = "blis";
  version = "0.7.11";
  version = "1.0.0";
  pyproject = true;

  disabled = pythonOlder "3.7";
  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "explosion";
    repo = "cython-blis";
    rev = "refs/tags/v${version}";
    hash = "sha256-p8pzGZc5OiiGTvXULDgzsBC3jIhovTKUq3RtPnQ/+to=";
    rev = "refs/tags/release-v${version}";
    hash = "sha256-XS6h2c+8BJ9pAvIX8340C4vRZEBRmEZc6/6tH7ooqNU=";
  };

  postPatch = ''
    # The commit pinning numpy to version 2 doesn't have any functional changes:
    # https://github.com/explosion/cython-blis/pull/108
    # BLIS should thus work with numpy and numpy_2.
    substituteInPlace pyproject.toml setup.py \
      --replace-fail "numpy>=2.0.0,<3.0.0" numpy

    # See https://github.com/numpy/numpy/issues/21079
    # has no functional difference as the name is only used in log output
    substituteInPlace blis/benchmark.py \
      --replace 'numpy.__config__.blas_ilp64_opt_info["libraries"]' '["dummy"]'
      --replace-fail 'numpy.__config__.blas_ilp64_opt_info["libraries"]' '["dummy"]'
  '';

  preCheck = ''
@@ -37,12 +45,13 @@ buildPythonPackage rec {
    rm -rf ./blis
  '';

  nativeBuildInputs = [
  build-system = [
    setuptools
    cython_0
    cython
    numpy
  ];

  propagatedBuildInputs = [ numpy ];
  dependencies = [ numpy ];

  nativeCheckInputs = [
    hypothesis
@@ -52,16 +61,18 @@ buildPythonPackage rec {
  pythonImportsCheck = [ "blis" ];

  passthru = {
    # Do not update to BLIS 0.9.x until the following issue is resolved:
    # https://github.com/explosion/thinc/issues/771#issuecomment-1255825935
    skipBulkUpdate = true;
    tests = {
      numpy_2 = blis.overridePythonAttrs (old: {
        numpy = numpy_2;
      });
    };
    updateScript = gitUpdater {
      rev-prefix = "v";
      ignoredVersions = "0\.9\..*";
      rev-prefix = "release-v";
    };
  };

  meta = with lib; {
    changelog = "https://github.com/explosion/cython-blis/releases/tag/release-v${version}";
    description = "BLAS-like linear algebra library";
    homepage = "https://github.com/explosion/cython-blis";
    license = licenses.bsd3;