1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 numpy,
11 onnx,
12 skl2onnx,
13
14 # tests
15 pytestCheckHook,
16 pandas,
17 xgboost,
18 onnxruntime,
19 scikit-learn,
20 pyspark,
21 lightgbm,
22}:
23
24buildPythonPackage rec {
25 pname = "onnxmltools";
26 version = "1.13";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "onnx";
31 repo = "onnxmltools";
32 tag = "v${version}";
33 hash = "sha256-uNd7N7/FgX8zaJp8ouvftwGqGqas8lZRXFmjpS+t2B4=";
34 };
35
36 postPatch = ''
37 substituteInPlace onnxmltools/proto/__init__.py \
38 --replace-fail \
39 "from onnx.helper import split_complex_to_pairs" \
40 "from onnx.helper import _split_complex_to_pairs as split_complex_to_pairs"
41 '';
42
43 build-system = [
44 setuptools
45 ];
46
47 dependencies = [
48 numpy
49 onnx
50 skl2onnx
51 ];
52
53 pythonImportsCheck = [ "onnxmltools" ];
54
55 # there are still some dependencies that need to be packaged for the tests to run
56 doCheck = false;
57
58 nativeCheckInputs = [
59 pytestCheckHook
60 pandas
61 xgboost
62 onnxruntime
63 scikit-learn
64 pyspark
65 lightgbm
66 # coremltools
67 # libsvm
68 # h20
69 ];
70
71 meta = {
72 description = "ONNXMLTools enables conversion of models to ONNX";
73 homepage = "https://github.com/onnx/onnxmltools";
74 changelog = "https://github.com/onnx/onnxmltools/blob/v${version}/CHANGELOGS.md";
75 license = lib.licenses.asl20;
76 maintainers = with lib.maintainers; [ happysalada ];
77 };
78}