summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/chex/default.nix
blob: dde855d7415c38164ce4d3ab4a1ab91c98e7b1fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  flit-core,

  # dependencies
  absl-py,
  jax,
  jaxlib,
  numpy,
  toolz,
  typing-extensions,

  # tests
  cloudpickle,
  dm-tree,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "chex";
  version = "0.1.91";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "deepmind";
    repo = "chex";
    tag = "v${version}";
    hash = "sha256-lJ9+kvG7dRtfDVgvkcJ9/jtnX0lMfxY4mmZ290y/74U=";
  };

  build-system = [
    flit-core
  ];

  pythonRelaxDeps = [
    "typing_extensions"
  ];
  dependencies = [
    absl-py
    jax
    jaxlib
    numpy
    toolz
    typing-extensions
  ];

  pythonImportsCheck = [ "chex" ];

  nativeCheckInputs = [
    cloudpickle
    dm-tree
    pytestCheckHook
  ];

  disabledTests = [
    # Jax 0.8.2 incompatibility (reported at https://github.com/google-deepmind/chex/issues/422)
    # AssertionError: AssertionError not raised
    "test_assert_tree_is_on_device"
    # AssertionError: "\[Chex\]\ [\s\S]*sharded arrays are disallowed" does not match ...
    "test_assert_tree_is_on_host"
    # AssertionError: [Chex] Assertion assert_tree_is_sharded failed: ...
    "test_assert_tree_is_sharded"
  ];

  meta = {
    description = "Library of utilities for helping to write reliable JAX code";
    homepage = "https://github.com/deepmind/chex";
    changelog = "https://github.com/google-deepmind/chex/releases/tag/v${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ ndl ];
  };
}