blob: 0160b24a5699f8799821b7a6364371ac9831baf5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, setuptools
, numpy
, pytestCheckHook
, absl-py
}:
buildPythonPackage rec {
pname = "ml-dtypes";
version = "0.3.2";
pyproject = true;
disabled = pythonOlder "3.9";
src = fetchFromGitHub {
owner = "jax-ml";
repo = "ml_dtypes";
rev = "refs/tags/v${version}";
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;
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace "numpy~=1.21.2" "numpy" \
--replace "numpy~=1.23.3" "numpy" \
--replace "numpy~=1.26.0" "numpy" \
--replace "setuptools~=68.1.0" "setuptools"
'';
nativeBuildInputs = [
setuptools
];
propagatedBuildInputs = [
numpy
];
nativeCheckInputs = [
pytestCheckHook
absl-py
];
preCheck = ''
# remove src module, so tests use the installed module instead
mv ./ml_dtypes/tests ./tests
rm -rf ./ml_dtypes
'';
pythonImportsCheck = [
"ml_dtypes"
];
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 ];
};
}
|