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