summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/tensorboardx/default.nix
blob: 52f5886b1ac79bc921d9dbffc622b210ac113ce3 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
  boto3,
  buildPythonPackage,
  crc32c,
  fetchFromGitHub,
  lib,
  matplotlib,
  moto,
  numpy,
  protobuf,
  pytestCheckHook,
  torch,
  setuptools-scm,
  soundfile,
  stdenv,
  tensorboard,
  torchvision,
}:

buildPythonPackage rec {
  pname = "tensorboardx";
  version = "2.6.2.2";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "lanpa";
    repo = "tensorboardX";
    tag = "v${version}";
    hash = "sha256-4eMkjya0B+r/DMQobeFJCfYHwnTOWrb+aNkkW2XvoqY=";
  };

  nativeBuildInputs = [
    protobuf
    setuptools-scm
  ];

  # required to make tests deterministic
  env.PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";

  propagatedBuildInputs = [
    crc32c
    numpy
  ];

  pythonImportsCheck = [ "tensorboardX" ];

  nativeCheckInputs = [
    boto3
    matplotlib
    moto
    pytestCheckHook
    soundfile
    torch
    tensorboard
    torchvision
  ];

  disabledTests = [
    # ImportError: Visdom visualization requires installation of Visdom
    "test_TorchVis"
    # Requires network access (FileNotFoundError: [Errno 2] No such file or directory: 'wget')
    "test_onnx_graph"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # Fails with a mysterious error in pytorch:
    # RuntimeError: required keyword attribute 'name' has the wrong type
    "test_pytorch_graph"
  ];

  disabledTestPaths = [
    # we are not interested in linting errors
    "tests/test_lint.py"
    # ImportError: cannot import name 'mock_s3' from 'moto'
    "tests/test_embedding.py"
    "tests/test_record_writer.py"
  ];

  meta = {
    description = "Library for writing tensorboard-compatible logs";
    homepage = "https://tensorboardx.readthedocs.io";
    downloadPage = "https://github.com/lanpa/tensorboardX";
    changelog = "https://github.com/lanpa/tensorboardX/blob/${src.rev}/HISTORY.rst";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      lebastr
      akamaus
    ];
    platforms = lib.platforms.all;
  };
}