1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6 flit-core,
7
8 # tests
9 chex,
10 jaxlib,
11 pytest-subtests,
12 pytest-xdist,
13 pytestCheckHook,
14 yapf,
15
16 # optional
17 jupyter,
18 mediapy,
19 numpy,
20 packaging,
21 protobuf,
22 fsspec,
23 importlib-resources,
24 typing-extensions,
25 zipp,
26 absl-py,
27 simple-parsing,
28 einops,
29 gcsfs,
30 s3fs,
31 tqdm,
32 dm-tree,
33 jax,
34 tensorflow,
35}:
36
37buildPythonPackage rec {
38 pname = "etils";
39 version = "1.13.0";
40 pyproject = true;
41
42 disabled = pythonOlder "3.10";
43
44 src = fetchPypi {
45 inherit pname version;
46 hash = "sha256-pbYMcflbzS1D1On7PcOHkSDB9gRyu1zhn3qGCx1E9gc=";
47 };
48
49 nativeBuildInputs = [ flit-core ];
50
51 optional-dependencies = rec {
52 array-types = enp;
53 eapp = [
54 absl-py
55 simple-parsing
56 ]
57 ++ epy;
58 ecolab = [
59 jupyter
60 numpy
61 mediapy
62 packaging
63 protobuf
64 ]
65 ++ enp
66 ++ epy
67 ++ etree;
68 edc = epy;
69 enp = [
70 numpy
71 einops
72 ]
73 ++ epy;
74 epath = [
75 fsspec
76 importlib-resources
77 typing-extensions
78 zipp
79 ]
80 ++ epy;
81 epath-gcs = [ gcsfs ] ++ epath;
82 epath-s3 = [ s3fs ] ++ epath;
83 epy = [ typing-extensions ];
84 etqdm = [
85 absl-py
86 tqdm
87 ]
88 ++ epy;
89 etree = array-types ++ epy ++ enp ++ etqdm;
90 etree-dm = [ dm-tree ] ++ etree;
91 etree-jax = [ jax ] ++ etree;
92 etree-tf = [ tensorflow ] ++ etree;
93 lazy-imports = ecolab;
94 all =
95 array-types
96 ++ eapp
97 ++ ecolab
98 ++ edc
99 ++ enp
100 ++ epath
101 ++ epath-gcs
102 ++ epath-s3
103 ++ epy
104 ++ etqdm
105 ++ etree
106 ++ etree-dm
107 ++ etree-jax
108 ++ etree-tf;
109 };
110
111 pythonImportsCheck = [ "etils" ];
112
113 nativeCheckInputs = [
114 chex
115 jaxlib
116 pytest-subtests
117 pytest-xdist
118 pytestCheckHook
119 yapf
120 ]
121 ++ optional-dependencies.all;
122
123 disabledTests = [
124 "test_public_access" # requires network access
125 ];
126
127 doCheck = false; # error: infinite recursion encountered
128
129 meta = with lib; {
130 changelog = "https://github.com/google/etils/blob/v${version}/CHANGELOG.md";
131 description = "Collection of eclectic utils";
132 homepage = "https://github.com/google/etils";
133 license = licenses.asl20;
134 maintainers = with maintainers; [ mcwitt ];
135 };
136}