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