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 = "1.1.0";
32 format = "pyproject";
33
34 disabled = pythonOlder "3.8";
35
36 src = fetchPypi {
37 inherit pname version;
38 hash = "sha256-eipJUHeaKB70x+WVriFZkLFcHYxviwonhQCSr1rSxkE=";
39 };
40
41 nativeBuildInputs = [
42 flit-core
43 ];
44
45 passthru.optional-dependencies = rec {
46 array-types = enp;
47 eapp = [ absl-py /* FIXME package simple-parsing */ ] ++ epy;
48 ecolab = [ jupyter numpy mediapy ] ++ enp ++ epy;
49 edc = epy;
50 enp = [ numpy ] ++ epy;
51 epath = [ importlib-resources typing-extensions zipp ] ++ epy;
52 epy = [ typing-extensions ];
53 etqdm = [ absl-py tqdm ] ++ epy;
54 etree = array-types ++ epy ++ enp ++ etqdm;
55 etree-dm = [ dm-tree ] ++ etree;
56 etree-jax = [ jax ] ++ etree;
57 etree-tf = [ tensorflow ] ++ etree;
58 all = array-types ++ eapp ++ ecolab ++ edc ++ enp ++ epath ++ epy ++ etqdm
59 ++ etree ++ etree-dm ++ etree-jax ++ etree-tf;
60 };
61
62 pythonImportsCheck = [
63 "etils"
64 ];
65
66 nativeCheckInputs = [
67 chex
68 jaxlib
69 pytest-subtests
70 pytest-xdist
71 pytestCheckHook
72 yapf
73 ]
74 ++ passthru.optional-dependencies.all;
75
76 disabledTests = [
77 "test_public_access" # requires network access
78 ];
79
80 doCheck = false; # error: infinite recursion encountered
81
82 meta = with lib; {
83 changelog = "https://github.com/google/etils/blob/v${version}/CHANGELOG.md";
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}