From 74a3ff502f07d7a6bbb344babcb0b26a72f803da Mon Sep 17 00:00:00 2001 From: Aiken Cairncross Date: Wed, 16 Oct 2019 00:31:30 +0100 Subject: [PATCH] pythonPackages.onnx: init at version 1.6.0 --- .../python-modules/onnx/default.nix | 78 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 80 insertions(+) create mode 100644 pkgs/development/python-modules/onnx/default.nix diff --git a/pkgs/development/python-modules/onnx/default.nix b/pkgs/development/python-modules/onnx/default.nix new file mode 100644 index 000000000000..3f3cf38f3332 --- /dev/null +++ b/pkgs/development/python-modules/onnx/default.nix @@ -0,0 +1,78 @@ +{ lib +, fetchpatch +, buildPythonPackage +, fetchPypi +, pythonOlder +, isPy27 +, cmake +, protobuf +, numpy +, six +, typing-extensions +, typing +, pytestrunner +, pytest +, nbval +, tabulate +}: + +buildPythonPackage rec { + pname = "onnx"; + version = "1.6.0"; + + # Due to Protobuf packaging issues this build of Onnx with Python 2 gives + # errors on import + disabled = isPy27; + + src = fetchPypi { + inherit pname version; + sha256 = "0ig33jl3591041lyylxp52yi20rfrcqx3i030hd6al8iabzc721v"; + }; + + # Remove the unqualified requirement for the typing package for running the + # tests. typing is already required for the installation, where it is + # correctly qualified so as to only be required for sufficiently old Python + # versions. + # This patch should be in the next release (>1.6). + patches = [ + (fetchpatch { + url = "https://github.com/onnx/onnx/commit/c963586d0f8dd5740777b2fd06f04ec60816de9f.patch"; + sha256 = "1hl26cw5zckc91gmh0bdah87jyprccxiw0f4i5h1gwkq28hm6wbj"; + }) + ]; + + 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 + ''; + + # The executables are just utility scripts that aren't too important + postInstall = '' + rm -r $out/bin + ''; + + # The setup.py does all the configuration (running CMake) + dontConfigure = true; + + meta = { + homepage = http://onnx.ai; + description = "Open Neural Network Exchange"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.acairncross ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f314cffbb52c..2b2248f6943a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -903,6 +903,8 @@ in { oauthenticator = callPackage ../development/python-modules/oauthenticator { }; + onnx = callPackage ../development/python-modules/onnx { }; + ordered-set = callPackage ../development/python-modules/ordered-set { }; ortools = (toPythonModule (pkgs.or-tools.override {