Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, hatchling
5, hatch-vcs
6, aiohttp
7, attrs
8, cattrs
9, circus
10, click
11, click-option-group
12, cloudpickle
13, deepmerge
14, fs
15, inflection
16, jinja2
17, numpy
18, opentelemetry-api
19, opentelemetry-instrumentation
20, opentelemetry-instrumentation-aiohttp-client
21, opentelemetry-instrumentation-asgi
22, opentelemetry-sdk
23, opentelemetry-semantic-conventions
24, opentelemetry-util-http
25, packaging
26, pathspec
27, pip-requirements-parser
28, pip-tools
29, prometheus-client
30, psutil
31, pynvml
32, python-dateutil
33, python-json-logger
34, python-multipart
35, pyyaml
36, requests
37, rich
38, schema
39, simple-di
40, starlette
41, uvicorn
42, watchfiles
43, fs-s3fs
44, grpcio
45, grpcio-health-checking
46, opentelemetry-instrumentation-grpc
47, protobuf
48, grpcio-channelz
49, grpcio-reflection
50, filetype
51, pillow
52, pydantic
53, pandas
54, pyarrow
55, opentelemetry-exporter-otlp-proto-http
56# https://pypi.org/project/opentelemetry-exporter-jaeger-proto-grpc/
57# , opentelemetry-exporter-jaeger # support for this exporter ends in july 2023
58, opentelemetry-exporter-otlp
59# , opentelemetry-exporter-zipkin
60, tritonclient
61# native check inputs
62, pytestCheckHook
63, scikit-learn
64, lxml
65, orjson
66, pytest-asyncio
67, fastapi
68}:
69
70let
71 version = "1.1.6";
72 aws = [ fs-s3fs ];
73 grpc = [
74 grpcio
75 grpcio-health-checking
76 opentelemetry-instrumentation-grpc
77 protobuf
78 ];
79 io-file = [ filetype ];
80 io-image = io-file ++ [ pillow ];
81 io-json = [ pydantic ];
82 io-pandas = [ pandas pyarrow ];
83 grpc-reflection = grpc ++ [ grpcio-reflection ];
84 grpc-channelz = grpc ++ [ grpcio-channelz ];
85 monitor-otlp = [ opentelemetry-exporter-otlp-proto-http ];
86 # tracing-jaeger = [ opentelemetry-exporter-jaeger ];
87 tracing-otlp = [ opentelemetry-exporter-otlp ];
88 # tracing-zipkin = [ opentelemetry-exporter-zipkin ];
89 io = io-json ++ io-image ++ io-pandas ++ io-file;
90 tracing = tracing-otlp; # ++ tracing-zipkin ++ tracing-jaeger
91 optional-dependencies = {
92 all = aws ++ io ++ grpc ++ grpc-reflection ++ grpc-channelz ++ tracing ++ monitor-otlp;
93 inherit aws grpc io-file io-image io-json io-pandas io grpc-reflection
94 grpc-channelz monitor-otlp tracing-otlp tracing;
95 triton = [ tritonclient ] ++ tritonclient.optional-dependencies.http ++ tritonclient.optional-dependencies.grpc;
96 };
97in
98buildPythonPackage {
99 pname = "bentoml";
100 inherit version;
101 format = "pyproject";
102
103 src = fetchFromGitHub {
104 owner = "bentoml";
105 repo = "BentoML";
106 rev = "refs/tags/v${version}";
107 hash = "sha256-SDahF4oAewWzCofErgYJDId/TBv74gLCxYT/jKEAgpU=";
108 };
109
110 pythonRelaxDeps = [
111 "opentelemetry-semantic-conventions"
112 ];
113
114 nativeBuildInputs = [
115 hatchling
116 hatch-vcs
117 ];
118
119 propagatedBuildInputs = [
120 aiohttp
121 attrs
122 cattrs
123 circus
124 click
125 click-option-group
126 cloudpickle
127 deepmerge
128 fs
129 inflection
130 jinja2
131 numpy
132 opentelemetry-api
133 opentelemetry-instrumentation
134 opentelemetry-instrumentation-aiohttp-client
135 opentelemetry-instrumentation-asgi
136 opentelemetry-sdk
137 opentelemetry-semantic-conventions
138 opentelemetry-util-http
139 packaging
140 pathspec
141 pip-requirements-parser
142 pip-tools
143 prometheus-client
144 psutil
145 pynvml
146 python-dateutil
147 python-json-logger
148 python-multipart
149 pyyaml
150 requests
151 rich
152 schema
153 simple-di
154 starlette
155 uvicorn
156 watchfiles
157 ];
158
159 passthru.optional-dependencies = optional-dependencies;
160
161 pythonImportsCheck = [ "bentoml" ];
162
163 preCheck = ''
164 # required for CI testing
165 # https://github.com/bentoml/BentoML/pull/4056/commits/66302b502a3f4df4e8e6643d2afefefca974073e
166 export GITHUB_ACTIONS=1
167 '';
168
169 disabledTestPaths = [
170 "tests/e2e"
171 "tests/integration"
172 ];
173
174 disabledTests = [
175 # flaky test
176 "test_store"
177 ];
178
179 nativeCheckInputs = [
180 pytestCheckHook
181 pandas
182 pydantic
183 scikit-learn
184 lxml
185 orjson
186 pytest-asyncio
187 pillow
188 fastapi
189 starlette
190 ] ++ optional-dependencies.grpc;
191
192
193 meta = with lib; {
194 description = "Build Production-Grade AI Applications";
195 homepage = "https://github.com/bentoml/BentoML";
196 changelog = "https://github.com/bentoml/BentoML/releases/tag/v${version}";
197 license = licenses.asl20;
198 maintainers = with maintainers; [ happysalada natsukium ];
199 };
200}