summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/bentoml/default.nix
blob: 691f92c7372f1712239c7791e13498ac8c580afa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
{
  lib,
  stdenv,
  a2wsgi,
  aiohttp,
  aiosqlite,
  attrs,
  buildPythonPackage,
  cattrs,
  circus,
  click-option-group,
  click,
  cloudpickle,
  deepmerge,
  fetchFromGitHub,
  fs-s3fs,
  fs,
  fsspec,
  grpcio-channelz,
  grpcio-health-checking,
  grpcio-reflection,
  grpcio,
  hatch-vcs,
  hatchling,
  httpx-ws,
  httpx,
  inflection,
  inquirerpy,
  jinja2,
  kantoku,
  numpy,
  nvidia-ml-py,
  opentelemetry-api,
  opentelemetry-exporter-otlp-proto-http,
  opentelemetry-exporter-otlp,
  opentelemetry-instrumentation-aiohttp-client,
  opentelemetry-instrumentation-asgi,
  opentelemetry-instrumentation-grpc,
  opentelemetry-instrumentation,
  opentelemetry-sdk,
  opentelemetry-semantic-conventions,
  opentelemetry-util-http,
  packaging,
  pandas,
  pathspec,
  pillow,
  pip-requirements-parser,
  prometheus-client,
  protobuf,
  psutil,
  pyarrow,
  pydantic,
  python-dateutil,
  python-json-logger,
  python-multipart,
  pythonOlder,
  pyyaml,
  questionary,
  rich,
  rich-toolkit,
  schema,
  simple-di,
  starlette,
  tomli-w,
  tomli,
  tritonclient,
  uv,
  uvicorn,
  watchfiles,
  # native check inputs
  pytestCheckHook,
  pytest-xdist,
  google-api-python-client,
  scikit-learn,
  lxml,
  orjson,
  pytest-asyncio,
  fastapi,
  writableTmpDirAsHomeHook,
}:

let
  version = "1.4.29";
  aws = [ fs-s3fs ];
  grpc = [
    grpcio
    grpcio-health-checking
    opentelemetry-instrumentation-grpc
    protobuf
  ];
  io-image = [ pillow ];
  io-pandas = [
    pandas
    pyarrow
  ];
  grpc-reflection = grpc ++ [ grpcio-reflection ];
  grpc-channelz = grpc ++ [ grpcio-channelz ];
  monitor-otlp = [
    opentelemetry-exporter-otlp-proto-http
    opentelemetry-instrumentation-grpc
  ];
  # tracing-jaeger = [ opentelemetry-exporter-jaeger ];
  tracing-otlp = [ opentelemetry-exporter-otlp ];
  # tracing-zipkin = [ opentelemetry-exporter-zipkin ];
  io = io-image ++ io-pandas;
  tracing = tracing-otlp; # ++ tracing-zipkin ++ tracing-jaeger
  optional-dependencies = {
    all = aws ++ io ++ grpc ++ grpc-reflection ++ grpc-channelz ++ tracing ++ monitor-otlp;
    inherit
      aws
      grpc
      io-image
      io-pandas
      io
      grpc-reflection
      grpc-channelz
      monitor-otlp
      tracing-otlp
      tracing
      ;
    triton = [
      tritonclient
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux (
      tritonclient.optional-dependencies.http ++ tritonclient.optional-dependencies.grpc
    );
  };

  src = fetchFromGitHub {
    owner = "bentoml";
    repo = "BentoML";
    tag = "v${version}";
    hash = "sha256-humzefKjnFpbWp9QVcUGPD0+3l2bOyFA35reZLtwFt4=";
  };
in
buildPythonPackage {
  pname = "bentoml";
  inherit version src;
  pyproject = true;

  pythonRelaxDeps = [
    "cattrs"
    "fsspec"
    "nvidia-ml-py"
    "opentelemetry-api"
    "opentelemetry-instrumentation-aiohttp-client"
    "opentelemetry-instrumentation-asgi"
    "opentelemetry-instrumentation"
    "opentelemetry-sdk"
    "opentelemetry-semantic-conventions"
    "opentelemetry-util-http"
    "rich-toolkit"
  ];

  build-system = [
    hatchling
    hatch-vcs
  ];

  dependencies = [
    a2wsgi
    aiohttp
    aiosqlite
    attrs
    cattrs
    circus
    click
    click-option-group
    cloudpickle
    deepmerge
    fs
    fsspec
    httpx
    httpx-ws
    inflection
    inquirerpy
    jinja2
    kantoku
    numpy
    nvidia-ml-py
    opentelemetry-api
    opentelemetry-instrumentation
    opentelemetry-instrumentation-aiohttp-client
    opentelemetry-instrumentation-asgi
    opentelemetry-sdk
    opentelemetry-semantic-conventions
    opentelemetry-util-http
    packaging
    pathspec
    pip-requirements-parser
    prometheus-client
    psutil
    pydantic
    python-dateutil
    python-json-logger
    python-multipart
    pyyaml
    questionary
    rich
    rich-toolkit
    schema
    simple-di
    starlette
    tomli-w
    uv
    uvicorn
    watchfiles
  ]
  ++ lib.optionals (pythonOlder "3.11") [ tomli ];

  inherit optional-dependencies;

  pythonImportsCheck = [ "bentoml" ];

  preCheck = ''
    # required for CI testing
    # https://github.com/bentoml/BentoML/pull/4056/commits/66302b502a3f4df4e8e6643d2afefefca974073e
    export GITHUB_ACTIONS=1
  '';

  disabledTestPaths = [
    "tests/e2e"
    "tests/integration"
    "tests/unit/grpc"
    "tests/unit/_internal/"
  ];

  disabledTests = [
    # flaky test
    "test_store"
    #
    "test_log_collection"
  ];

  nativeCheckInputs = [
    fastapi
    google-api-python-client
    lxml
    orjson
    pandas
    pillow
    pytest-asyncio
    pytest-xdist
    pytestCheckHook
    scikit-learn
    writableTmpDirAsHomeHook
  ]
  ++ optional-dependencies.grpc;

  meta = {
    description = "Build Production-Grade AI Applications";
    homepage = "https://github.com/bentoml/BentoML";
    changelog = "https://github.com/bentoml/BentoML/releases/tag/${src.tag}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [
      happysalada
      natsukium
    ];
  };
}