1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 deprecation,
8 poetry-core,
9
10 # dependencies
11 cloudevents,
12 fastapi,
13 grpcio,
14 httpx,
15 kubernetes,
16 numpy,
17 orjson,
18 pandas,
19 uvicorn,
20
21 # optional-dependencies
22 azure-identity,
23 azure-storage-blob,
24 azure-storage-file-share,
25 boto3,
26 google-cloud-storage,
27 huggingface-hub,
28 asgi-logger,
29 ray,
30
31 prometheus-client,
32 protobuf,
33 requests,
34 psutil,
35 pydantic,
36 python-dateutil,
37 pyyaml,
38 six,
39 tabulate,
40 timing-asgi,
41
42 # tests
43 avro,
44 grpcio-testing,
45 pytest-asyncio,
46 pytestCheckHook,
47 tomlkit,
48}:
49
50buildPythonPackage rec {
51 pname = "kserve";
52 version = "0.14.0";
53 pyproject = true;
54
55 src = fetchFromGitHub {
56 owner = "kserve";
57 repo = "kserve";
58 rev = "refs/tags/v${version}";
59 hash = "sha256-N/IgiTiyBNw7WQWxcUJlXU+Q9o3UUaduD9ZBKwu0uRE=";
60 };
61
62 sourceRoot = "${src.name}/python/kserve";
63
64 pythonRelaxDeps = [
65 "fastapi"
66 "httpx"
67 "prometheus-client"
68 "protobuf"
69 "uvicorn"
70 "psutil"
71 ];
72
73 build-system = [
74 deprecation
75 poetry-core
76 ];
77
78 dependencies = [
79 cloudevents
80 fastapi
81 grpcio
82 httpx
83 kubernetes
84 numpy
85 orjson
86 pandas
87 prometheus-client
88 protobuf
89 psutil
90 pydantic
91 python-dateutil
92 pyyaml
93 six
94 tabulate
95 timing-asgi
96 uvicorn
97 ];
98
99 optional-dependencies = {
100 storage = [
101 azure-identity
102 azure-storage-blob
103 azure-storage-file-share
104 boto3
105 huggingface-hub
106 google-cloud-storage
107 requests
108 ];
109 logging = [ asgi-logger ];
110 ray = [ ray ];
111 };
112
113 nativeCheckInputs = [
114 avro
115 grpcio-testing
116 pytest-asyncio
117 pytestCheckHook
118 tomlkit
119 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
120
121 pythonImportsCheck = [ "kserve" ];
122
123 disabledTestPaths = [
124 # Looks for a config file at the root of the repository
125 "test/test_inference_service_client.py"
126 ];
127
128 disabledTests = [
129 # Require network access
130 "test_infer_graph_endpoint"
131 "test_infer_path_based_routing"
132
133 # Tries to access `/tmp` (hardcoded)
134 "test_local_path_with_out_dir_exist"
135 ];
136
137 meta = {
138 description = "Standardized Serverless ML Inference Platform on Kubernetes";
139 homepage = "https://github.com/kserve/kserve/tree/master/python/kserve";
140 changelog = "https://github.com/kserve/kserve/releases/tag/v${version}";
141 license = lib.licenses.asl20;
142 maintainers = with lib.maintainers; [ GaetanLepage ];
143 };
144}