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 importlib-resources,
21 typing-extensions,
22 zipp,
23 absl-py,
24 tqdm,
25 dm-tree,
26 jax,
27 tensorflow,
28}:
29
30buildPythonPackage rec {
31 pname = "etils";
32 version = "1.12.2";
33 pyproject = true;
34
35 disabled = pythonOlder "3.10";
36
37 src = fetchPypi {
38 inherit pname version;
39 hash = "sha256-xrnh8M5m0bv1T5kgGwimC6OW00RtnrGNS8ObJqLhpe4=";
40 };
41
42 nativeBuildInputs = [ flit-core ];
43
44 optional-dependencies = rec {
45 array-types = enp;
46 eapp = [
47 absl-py # FIXME package simple-parsing
48 ] ++ epy;
49 ecolab =
50 [
51 jupyter
52 numpy
53 mediapy
54 ]
55 ++ enp
56 ++ epy;
57 edc = epy;
58 enp = [ numpy ] ++ epy;
59 epath = [
60 importlib-resources
61 typing-extensions
62 zipp
63 ] ++ epy;
64 epy = [ typing-extensions ];
65 etqdm = [
66 absl-py
67 tqdm
68 ] ++ epy;
69 etree = array-types ++ epy ++ enp ++ etqdm;
70 etree-dm = [ dm-tree ] ++ etree;
71 etree-jax = [ jax ] ++ etree;
72 etree-tf = [ tensorflow ] ++ etree;
73 all =
74 array-types
75 ++ eapp
76 ++ ecolab
77 ++ edc
78 ++ enp
79 ++ epath
80 ++ epy
81 ++ etqdm
82 ++ etree
83 ++ etree-dm
84 ++ etree-jax
85 ++ etree-tf;
86 };
87
88 pythonImportsCheck = [ "etils" ];
89
90 nativeCheckInputs = [
91 chex
92 jaxlib
93 pytest-subtests
94 pytest-xdist
95 pytestCheckHook
96 yapf
97 ] ++ optional-dependencies.all;
98
99 disabledTests = [
100 "test_public_access" # requires network access
101 ];
102
103 doCheck = false; # error: infinite recursion encountered
104
105 meta = with lib; {
106 changelog = "https://github.com/google/etils/blob/v${version}/CHANGELOG.md";
107 description = "Collection of eclectic utils";
108 homepage = "https://github.com/google/etils";
109 license = licenses.asl20;
110 maintainers = with maintainers; [ mcwitt ];
111 };
112}