diff options
Diffstat (limited to 'pkgs/development/python-modules/onnx/default.nix')
-rw-r--r-- | pkgs/development/python-modules/onnx/default.nix | 101 |
1 files changed, 33 insertions, 68 deletions
diff --git a/pkgs/development/python-modules/onnx/default.nix b/pkgs/development/python-modules/onnx/default.nix index a0cc441e2e50..0af451607af3 100644 --- a/pkgs/development/python-modules/onnx/default.nix +++ b/pkgs/development/python-modules/onnx/default.nix @@ -1,23 +1,27 @@ { lib, - stdenv, buildPythonPackage, - cmake, fetchFromGitHub, + + # build-system + cmake, + pybind11, + setuptools, + + # buildInputs + abseil-cpp, + protobuf, gtest, - nbval, + + # dependencies numpy, + + google-re2, + nbval, parameterized, - protobuf_21, - pybind11, + pillow, pytestCheckHook, - pythonOlder, tabulate, - typing-extensions, - abseil-cpp, - google-re2, - pillow, - protobuf, }: let @@ -25,64 +29,54 @@ let in buildPythonPackage rec { pname = "onnx"; - version = "1.16.2"; - format = "setuptools"; - - disabled = pythonOlder "3.8"; + version = "1.17.0"; + pyproject = true; src = fetchFromGitHub { - owner = pname; - repo = pname; + owner = "onnx"; + repo = "onnx"; rev = "refs/tags/v${version}"; - hash = "sha256-JmxnsHRrzj2QzPz3Yndw0MmgZJ8MDYxHjuQ7PQkQsDg="; + hash = "sha256-9oORW0YlQ6SphqfbjcYb0dTlHc+1gzy9quH/Lj6By8Q="; }; build-system = [ cmake - pybind11 + protobuf + setuptools ]; buildInputs = [ abseil-cpp - protobuf - google-re2 gtestStatic - pillow + pybind11 ]; dependencies = [ - protobuf_21 protobuf numpy - typing-extensions ]; nativeCheckInputs = [ + google-re2 nbval parameterized + pillow pytestCheckHook tabulate ]; postPatch = '' + rm -r third_party + chmod +x tools/protoc-gen-mypy.sh.in patchShebangs tools/protoc-gen-mypy.sh.in - - substituteInPlace setup.py \ - --replace 'setup_requires.append("pytest-runner")' "" - - # prevent from fetching & building own gtest - substituteInPlace CMakeLists.txt \ - --replace 'include(googletest)' "" - substituteInPlace cmake/unittest.cmake \ - --replace 'googletest)' ')' ''; preConfigure = '' # Set CMAKE_INSTALL_LIBDIR to lib explicitly, because otherwise it gets set # to lib64 and cmake incorrectly looks for the protobuf library in lib64 export CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib -DONNX_USE_PROTOBUF_SHARED_LIBS=ON" - export CMAKE_ARGS+=" -Dgoogletest_STATIC_LIBRARIES=${gtestStatic}/lib/libgtest.a -Dgoogletest_INCLUDE_DIRS=${lib.getDev gtestStatic}/include" + export CMAKE_ARGS+=" -Dgoogletest_STATIC_LIBRARIES=${gtestStatic}/lib/libgtest.a" export ONNX_BUILD_TESTS=1 ''; @@ -107,37 +101,7 @@ buildPythonPackage rec { pytestFlagsArray = [ "onnx/test" - "onnx/examples" - ]; - - disabledTests = - [ - # attempts to fetch data from web - "test_bvlc_alexnet_cpu" - "test_densenet121_cpu" - "test_inception_v1_cpu" - "test_inception_v2_cpu" - "test_resnet50_cpu" - "test_shufflenet_cpu" - "test_squeezenet_cpu" - "test_vgg19_cpu" - "test_zfnet512_cpu" - ] - ++ lib.optionals stdenv.isAarch64 [ - # AssertionError: Output 0 of test 0 in folder - "test__pytorch_converted_Conv2d_depthwise_padded" - "test__pytorch_converted_Conv2d_dilated" - "test_dft" - "test_dft_axis" - # AssertionError: Mismatch in test 'test_Conv2d_depthwise_padded' - "test_xor_bcast4v4d" - # AssertionError: assert 1 == 0 - "test_ops_tested" - ]; - - disabledTestPaths = [ - # Unexpected output fields from running code: {'stderr'} - "onnx/examples/np_array_tensorproto.ipynb" + "examples" ]; __darwinAllowLocalNetworking = true; @@ -149,10 +113,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "onnx" ]; - meta = with lib; { + meta = { description = "Open Neural Network Exchange"; homepage = "https://onnx.ai"; - license = licenses.asl20; - maintainers = with maintainers; [ acairncross ]; + changelog = "https://github.com/onnx/onnx/releases/tag/${lib.removePrefix "refs/tags/" src.rev}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ acairncross ]; }; } |