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