1{
2 boto3,
3 buildPythonPackage,
4 crc32c,
5 fetchFromGitHub,
6 lib,
7 matplotlib,
8 moto,
9 numpy,
10 protobuf,
11 pytestCheckHook,
12 torch,
13 setuptools-scm,
14 soundfile,
15 stdenv,
16 tensorboard,
17 torchvision,
18}:
19
20buildPythonPackage rec {
21 pname = "tensorboardx";
22 version = "2.6.2.2";
23 format = "setuptools";
24
25 src = fetchFromGitHub {
26 owner = "lanpa";
27 repo = "tensorboardX";
28 tag = "v${version}";
29 hash = "sha256-4eMkjya0B+r/DMQobeFJCfYHwnTOWrb+aNkkW2XvoqY=";
30 };
31
32 nativeBuildInputs = [
33 protobuf
34 setuptools-scm
35 ];
36
37 # required to make tests deterministic
38 env.PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
39
40 propagatedBuildInputs = [
41 crc32c
42 numpy
43 ];
44
45 pythonImportsCheck = [ "tensorboardX" ];
46
47 nativeCheckInputs = [
48 boto3
49 matplotlib
50 moto
51 pytestCheckHook
52 soundfile
53 torch
54 tensorboard
55 torchvision
56 ];
57
58 disabledTests = [
59 # ImportError: Visdom visualization requires installation of Visdom
60 "test_TorchVis"
61 # Requires network access (FileNotFoundError: [Errno 2] No such file or directory: 'wget')
62 "test_onnx_graph"
63 ]
64 ++ lib.optionals stdenv.hostPlatform.isDarwin [
65 # Fails with a mysterious error in pytorch:
66 # RuntimeError: required keyword attribute 'name' has the wrong type
67 "test_pytorch_graph"
68 ];
69
70 disabledTestPaths = [
71 # we are not interested in linting errors
72 "tests/test_lint.py"
73 # ImportError: cannot import name 'mock_s3' from 'moto'
74 "tests/test_embedding.py"
75 "tests/test_record_writer.py"
76 ];
77
78 meta = with lib; {
79 description = "Library for writing tensorboard-compatible logs";
80 homepage = "https://tensorboardx.readthedocs.io";
81 downloadPage = "https://github.com/lanpa/tensorboardX";
82 changelog = "https://github.com/lanpa/tensorboardX/blob/${src.rev}/HISTORY.rst";
83 license = licenses.mit;
84 maintainers = with maintainers; [
85 lebastr
86 akamaus
87 ];
88 platforms = platforms.all;
89 };
90}