1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 hatchling,
7 jupyter,
8 nbconvert,
9 numpy,
10 parameterized,
11 pillow,
12 pytestCheckHook,
13 pythonOlder,
14}:
15
16buildPythonPackage rec {
17 pname = "einops";
18 version = "0.8.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "arogozhnikov";
25 repo = pname;
26 tag = "v${version}";
27 hash = "sha256-6x9AttvSvgYrHaS5ESKOwyEnXxD2BitYTGtqqSKur+0=";
28 };
29
30 patches = [
31 # https://github.com/arogozhnikov/einops/pull/325
32 (fetchpatch2 {
33 name = "numpy_2-compatibility.patch";
34 url = "https://github.com/arogozhnikov/einops/commit/11680b457ce2216d9827330d0b794565946847d7.patch";
35 hash = "sha256-OKWp319ClYarNrek7TdRHt+NKTOEfBdJaV0U/6vLeMc=";
36 })
37 ];
38
39 nativeBuildInputs = [ hatchling ];
40
41 nativeCheckInputs = [
42 jupyter
43 nbconvert
44 numpy
45 parameterized
46 pillow
47 pytestCheckHook
48 ];
49
50 env.EINOPS_TEST_BACKENDS = "numpy";
51
52 preCheck = ''
53 export HOME=$(mktemp -d);
54 '';
55
56 pythonImportsCheck = [ "einops" ];
57
58 disabledTests = [
59 # Tests are failing as mxnet is not pulled-in
60 # https://github.com/NixOS/nixpkgs/issues/174872
61 "test_all_notebooks"
62 "test_dl_notebook_with_all_backends"
63 "test_backends_installed"
64 ];
65
66 disabledTestPaths = [ "tests/test_layers.py" ];
67
68 __darwinAllowLocalNetworking = true;
69
70 meta = with lib; {
71 description = "Flexible and powerful tensor operations for readable and reliable code";
72 homepage = "https://github.com/arogozhnikov/einops";
73 license = licenses.mit;
74 maintainers = with maintainers; [ yl3dy ];
75 };
76}