1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5, flit-core
6
7 # tests
8, chex
9, jaxlib
10, pytest-subtests
11, pytest-xdist
12, pytestCheckHook
13, yapf
14
15 # optional
16, jupyter
17, mediapy
18, numpy
19, importlib-resources
20, typing-extensions
21, zipp
22, absl-py
23, tqdm
24, dm-tree
25, jax
26, tensorflow
27}:
28
29buildPythonPackage rec {
30 pname = "etils";
31 version = "0.8.0";
32 format = "pyproject";
33
34 disabled = pythonOlder "3.7";
35
36 src = fetchPypi {
37 inherit pname version;
38 hash = "sha256-0dWve9nHhKJzxOHsz6qP6speBIGghxe1MT+iMdoiqQM=";
39 };
40
41 nativeBuildInputs = [
42 flit-core
43 ];
44
45 passthru.optional-dependencies = rec {
46 array-types = enp;
47 ecolab = [ jupyter numpy mediapy ] ++ enp ++ epy;
48 edc = epy;
49 enp = [ numpy ] ++ epy;
50 epath = [ importlib-resources typing-extensions zipp ] ++ epy;
51 epy = [ typing-extensions ];
52 etqdm = [ absl-py tqdm ] ++ epy;
53 etree = array-types ++ epy ++ enp ++ etqdm;
54 etree-dm = [ dm-tree ] ++ etree;
55 etree-jax = [ jax ] ++ etree;
56 etree-tf = [ tensorflow etree ] ++ etree;
57 all = array-types ++ ecolab ++ edc ++ enp ++ epath ++ epy ++ etqdm
58 ++ etree ++ etree-dm ++ etree-jax ++ etree-tf;
59 };
60
61 pythonImportsCheck = [
62 "etils"
63 ];
64
65 checkInputs = [
66 chex
67 jaxlib
68 pytest-subtests
69 pytest-xdist
70 pytestCheckHook
71 yapf
72 ]
73 ++ passthru.optional-dependencies.all;
74
75 disabledTests = [
76 "test_repr" # known to fail on Python 3.10, see https://github.com/google/etils/issues/143
77 "test_public_access" # requires network access
78 "test_resource_path" # known to fail on Python 3.10, see https://github.com/google/etils/issues/143
79 ];
80
81 doCheck = false; # error: infinite recursion encountered
82
83 meta = with lib; {
84 description = "Collection of eclectic utils for python";
85 homepage = "https://github.com/google/etils";
86 license = licenses.asl20;
87 maintainers = with maintainers; [ mcwitt ];
88 };
89}