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