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