1{
2 lib,
3 buildPythonPackage,
4 fetchpatch,
5 fetchPypi,
6 setuptools,
7 numpy,
8 pytestCheckHook,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 version = "3.3.0";
14 pname = "opt-einsum";
15 pyproject = true;
16
17 disabled = pythonOlder "3.6";
18
19 src = fetchPypi {
20 pname = "opt_einsum";
21 inherit version;
22 hash = "sha256-WfZHX3e7w33PfNdIUZwOxgci6R5jyhFOaIIcDFSkZUk=";
23 };
24
25 patches = [
26 # https://github.com/dgasmith/opt_einsum/pull/208
27 (fetchpatch {
28 name = "python312-compatibility.patch";
29 url = "https://github.com/dgasmith/opt_einsum/commit/0beacf96923bbb2dd1939a9c59398a38ce7a11b1.patch";
30 hash = "sha256-dmmEzhy17huclo1wOubpBUDc2L7vqEU5b/6a5loM47A=";
31 })
32 ];
33
34 nativeBuildInputs = [ setuptools ];
35
36 propagatedBuildInputs = [ numpy ];
37
38 nativeCheckInputs = [ pytestCheckHook ];
39
40 pythonImportsCheck = [ "opt_einsum" ];
41
42 meta = with lib; {
43 description = "Optimizing NumPy's einsum function with order optimization and GPU support";
44 homepage = "https://github.com/dgasmith/opt_einsum";
45 license = licenses.mit;
46 maintainers = with maintainers; [ teh ];
47 };
48}