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";
23 format = "setuptools";
24
25 src = fetchFromGitHub {
26 owner = "lanpa";
27 repo = "tensorboardX";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-m7RLDOMuRNLacnIudptBGjhcTlMk8+v/onz6Amqxb90=";
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 [
60 # ImportError: Visdom visualization requires installation of Visdom
61 "test_TorchVis"
62 # Requires network access (FileNotFoundError: [Errno 2] No such file or directory: 'wget')
63 "test_onnx_graph"
64 ]
65 ++ lib.optionals stdenv.isDarwin [
66 # Fails with a mysterious error in pytorch:
67 # RuntimeError: required keyword attribute 'name' has the wrong type
68 "test_pytorch_graph"
69 ];
70
71 disabledTestPaths = [
72 # we are not interested in linting errors
73 "tests/test_lint.py"
74 # ImportError: cannot import name 'mock_s3' from 'moto'
75 "tests/test_embedding.py"
76 "tests/test_record_writer.py"
77 ];
78
79 meta = with lib; {
80 description = "Library for writing tensorboard-compatible logs";
81 homepage = "https://tensorboardx.readthedocs.io";
82 downloadPage = "https://github.com/lanpa/tensorboardX";
83 changelog = "https://github.com/lanpa/tensorboardX/blob/${src.rev}/HISTORY.rst";
84 license = licenses.mit;
85 maintainers = with maintainers; [
86 lebastr
87 akamaus
88 ];
89 platforms = platforms.all;
90 };
91}