nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at haskell-updates 82 lines 1.4 kB view raw
1{ 2 buildPythonPackage, 3 onnx, # pkgs.onnx 4 5 # dependencies 6 ml-dtypes, 7 numpy, 8 protobuf, 9 typing-extensions, 10 11 # tests 12 parameterized, 13 pillow, 14 pytestCheckHook, 15 writableTmpDirAsHomeHook, 16}: 17buildPythonPackage { 18 inherit (onnx) 19 pname 20 src # Needed for testing. 21 version 22 ; 23 24 format = "wheel"; 25 26 dontUseWheelUnpack = true; 27 28 postUnpack = '' 29 cp -rv "${onnx.dist}" "$sourceRoot/dist" 30 chmod +w "$sourceRoot/dist" 31 ''; 32 33 buildInputs = [ 34 # onnx must be included to avoid shrinking during fixupPhase removing the RUNPATH entry on 35 # onnx_cpp2py_export.cpython-*.so. 36 onnx 37 ]; 38 39 dependencies = [ 40 ml-dtypes 41 numpy 42 protobuf 43 typing-extensions 44 ]; 45 46 nativeCheckInputs = [ 47 parameterized 48 pillow 49 pytestCheckHook 50 writableTmpDirAsHomeHook 51 ]; 52 53 # The executables are just utility scripts that aren't too important 54 postInstall = '' 55 rm -rv $out/bin 56 ''; 57 58 # detecting source dir as a python package confuses pytest 59 preCheck = '' 60 rm onnx/__init__.py 61 ''; 62 63 enabledTestPaths = [ 64 "onnx/test" 65 "examples" 66 ]; 67 68 __darwinAllowLocalNetworking = true; 69 70 pythonImportsCheck = [ "onnx" ]; 71 72 meta = { 73 # Explicitly inherit from ONNX's meta to avoid pulling in attributes added by stdenv.mkDerivation. 74 inherit (onnx.meta) 75 changelog 76 description 77 homepage 78 license 79 maintainers 80 ; 81 }; 82}