about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/onnx/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/onnx/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/onnx/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/onnx/default.nix b/nixpkgs/pkgs/development/python-modules/onnx/default.nix
new file mode 100644
index 000000000000..278d7c1df046
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/onnx/default.nix
@@ -0,0 +1,71 @@
+{ lib
+, fetchpatch
+, buildPythonPackage
+, fetchPypi
+, pythonOlder
+, isPy27
+, cmake
+, protobuf
+, numpy
+, six
+, typing-extensions
+, typing
+, pytestrunner
+, pytest
+, nbval
+, tabulate
+}:
+
+buildPythonPackage rec {
+  pname = "onnx";
+  version = "1.8.0";
+
+  # Due to Protobuf packaging issues this build of Onnx with Python 2 gives
+  # errors on import.
+  # Also support for Python 2 will be deprecated from Onnx v1.8.
+  disabled = isPy27;
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "5f787fd3ce1290e12da335237b3b921152157e51aa09080b65631b3ce3fcc50c";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  propagatedBuildInputs = [
+    protobuf
+    numpy
+    six
+    typing-extensions
+  ] ++ lib.optional (pythonOlder "3.5") [ typing ];
+
+  checkInputs = [
+    pytestrunner
+    pytest
+    nbval
+    tabulate
+  ];
+
+  postPatch = ''
+    patchShebangs tools/protoc-gen-mypy.py
+  '';
+
+  preBuild = ''
+    export MAX_JOBS=$NIX_BUILD_CORES
+  '';
+
+  # The executables are just utility scripts that aren't too important
+  postInstall = ''
+    rm -r $out/bin
+  '';
+
+  # The setup.py does all the configuration
+  dontUseCmakeConfigure = true;
+
+  meta = {
+    homepage    = "http://onnx.ai";
+    description = "Open Neural Network Exchange";
+    license     = lib.licenses.mit;
+    maintainers = [ lib.maintainers.acairncross ];
+  };
+}