nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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}:
15
16buildPythonPackage rec {
17 pname = "onnx";
18 version = "1.11.0";
19 format = "setuptools";
20
21 disabled = isPy27;
22
23 src = fetchPypi {
24 inherit pname version;
25 sha256 = "sha256-7KIkx8LI7kByoHQ+SJioSpvfgpe15ZEKJjLkxBgv+yo=";
26 };
27
28 nativeBuildInputs = [
29 cmake
30 ];
31
32 propagatedBuildInputs = [
33 protobuf
34 numpy
35 six
36 typing-extensions
37 ];
38
39 checkInputs = [
40 nbval
41 pytestCheckHook
42 tabulate
43 ];
44
45 postPatch = ''
46 chmod +x tools/protoc-gen-mypy.sh.in
47 patchShebangs tools/protoc-gen-mypy.py
48 substituteInPlace tools/protoc-gen-mypy.sh.in \
49 --replace "/bin/bash" "${bash}/bin/bash"
50 substituteInPlace setup.py \
51 --replace "setup_requires.append('pytest-runner')" ""
52 '';
53
54 preBuild = ''
55 export MAX_JOBS=$NIX_BUILD_CORES
56 '';
57
58 disabledTestPaths = [
59 # Unexpected output fields from running code: {'stderr'}
60 "onnx/examples/np_array_tensorproto.ipynb"
61 ];
62
63 # The executables are just utility scripts that aren't too important
64 postInstall = ''
65 rm -r $out/bin
66 '';
67
68 # The setup.py does all the configuration
69 dontUseCmakeConfigure = true;
70
71 pythonImportsCheck = [
72 "onnx"
73 ];
74
75 meta = with lib; {
76 description = "Open Neural Network Exchange";
77 homepage = "https://onnx.ai";
78 license = licenses.asl20;
79 maintainers = with maintainers; [ acairncross ];
80 };
81}