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