1{ lib
2, buildPythonPackage
3, bash
4, cmake
5, fetchPypi
6, isPy27
7, nbval
8, numpy
9, protobuf
10, pytestCheckHook
11, six
12, tabulate
13, typing-extensions
14, pythonRelaxDepsHook
15, pytest-runner
16}:
17
18buildPythonPackage rec {
19 pname = "onnx";
20 version = "1.12.0";
21 format = "setuptools";
22
23 disabled = isPy27;
24
25 src = fetchPypi {
26 inherit pname version;
27 sha256 = "sha256-E7PnfSdSO52/TzDfyclZRVhZ1eNOkhxE9xLWm4Np7/k=";
28 };
29
30 nativeBuildInputs = [
31 cmake
32 pythonRelaxDepsHook
33 ];
34
35 pythonRelaxDeps = [ "protobuf" ];
36
37 propagatedBuildInputs = [
38 protobuf
39 numpy
40 six
41 typing-extensions
42 ];
43
44 checkInputs = [
45 nbval
46 pytestCheckHook
47 pytest-runner
48 tabulate
49 ];
50
51 postPatch = ''
52 chmod +x tools/protoc-gen-mypy.sh.in
53 patchShebangs tools/protoc-gen-mypy.py
54 substituteInPlace tools/protoc-gen-mypy.sh.in \
55 --replace "/bin/bash" "${bash}/bin/bash"
56 '';
57
58 preBuild = ''
59 export MAX_JOBS=$NIX_BUILD_CORES
60 '';
61
62 disabledTestPaths = [
63 # Unexpected output fields from running code: {'stderr'}
64 "onnx/examples/np_array_tensorproto.ipynb"
65 ];
66
67 # The executables are just utility scripts that aren't too important
68 postInstall = ''
69 rm -r $out/bin
70 '';
71
72 # The setup.py does all the configuration
73 dontUseCmakeConfigure = true;
74
75 pythonImportsCheck = [
76 "onnx"
77 ];
78
79 meta = with lib; {
80 description = "Open Neural Network Exchange";
81 homepage = "https://onnx.ai";
82 license = licenses.asl20;
83 maintainers = with maintainers; [ acairncross ];
84 };
85}