about summary refs log tree commit diff
path: root/pkgs/development/python-modules/bentoml/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/bentoml/default.nix')
-rw-r--r--pkgs/development/python-modules/bentoml/default.nix240
1 files changed, 136 insertions, 104 deletions
diff --git a/pkgs/development/python-modules/bentoml/default.nix b/pkgs/development/python-modules/bentoml/default.nix
index 6946f45e050f..b8a5dbb48d35 100644
--- a/pkgs/development/python-modules/bentoml/default.nix
+++ b/pkgs/development/python-modules/bentoml/default.nix
@@ -1,75 +1,80 @@
-{ lib
-, buildPythonPackage
-, fetchFromGitHub
-, hatchling
-, hatch-vcs
-, aiohttp
-, attrs
-, cattrs
-, circus
-, click
-, click-option-group
-, cloudpickle
-, deepmerge
-, fs
-, httpx
-, inflection
-, jinja2
-, numpy
-, opentelemetry-api
-, opentelemetry-instrumentation
-, opentelemetry-instrumentation-aiohttp-client
-, opentelemetry-instrumentation-asgi
-, opentelemetry-sdk
-, opentelemetry-semantic-conventions
-, opentelemetry-util-http
-, packaging
-, pathspec
-, pip-requirements-parser
-, pip-tools
-, prometheus-client
-, psutil
-, nvidia-ml-py
-, python-dateutil
-, python-json-logger
-, python-multipart
-, pyyaml
-, requests
-, rich
-, schema
-, simple-di
-, starlette
-, uvicorn
-, watchfiles
-, fs-s3fs
-, grpcio
-, grpcio-health-checking
-, opentelemetry-instrumentation-grpc
-, protobuf
-, grpcio-channelz
-, grpcio-reflection
-, filetype
-, pillow
-, pydantic
-, pandas
-, pyarrow
-, opentelemetry-exporter-otlp-proto-http
-# https://pypi.org/project/opentelemetry-exporter-jaeger-proto-grpc/
-# , opentelemetry-exporter-jaeger # support for this exporter ends in july 2023
-, opentelemetry-exporter-otlp
-# , opentelemetry-exporter-zipkin
-, tritonclient
-# native check inputs
-, pytestCheckHook
-, scikit-learn
-, lxml
-, orjson
-, pytest-asyncio
-, fastapi
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  fetchFromGitHub,
+  pythonOlder,
+  hatchling,
+  hatch-vcs,
+  aiohttp,
+  aiosqlite,
+  attrs,
+  cattrs,
+  circus,
+  click,
+  click-option-group,
+  cloudpickle,
+  deepmerge,
+  fs,
+  fs-s3fs,
+  grpcio,
+  grpcio-channelz,
+  grpcio-health-checking,
+  grpcio-reflection,
+  httpx,
+  httpx-ws,
+  inflection,
+  inquirerpy,
+  jinja2,
+  numpy,
+  nvidia-ml-py,
+  opentelemetry-api,
+  opentelemetry-exporter-otlp,
+  opentelemetry-exporter-otlp-proto-http,
+  opentelemetry-instrumentation,
+  opentelemetry-instrumentation-aiohttp-client,
+  opentelemetry-instrumentation-asgi,
+  opentelemetry-instrumentation-grpc,
+  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,
+  pyyaml,
+  rich,
+  schema,
+  simple-di,
+  starlette,
+  tomli,
+  tomli-w,
+  tritonclient,
+  uv,
+  uvicorn,
+  watchfiles,
+  # native check inputs
+  pytestCheckHook,
+  pytest-xdist,
+  google-api-python-client,
+  scikit-learn,
+  lxml,
+  orjson,
+  pytest-asyncio,
+  fastapi,
 }:
 
 let
-  version = "1.2.5";
+  version = "1.3.7";
   aws = [ fs-s3fs ];
   grpc = [
     grpcio
@@ -77,54 +82,75 @@ let
     opentelemetry-instrumentation-grpc
     protobuf
   ];
-  io-file = [ filetype ];
-  io-image = io-file ++ [ pillow ];
-  io-json = [ pydantic ];
-  io-pandas = [ pandas pyarrow ];
+  io-image = [ pillow ];
+  io-pandas = [
+    pandas
+    pyarrow
+  ];
   grpc-reflection = grpc ++ [ grpcio-reflection ];
   grpc-channelz = grpc ++ [ grpcio-channelz ];
-  monitor-otlp = [ opentelemetry-exporter-otlp-proto-http ];
+  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-json ++ io-image ++ io-pandas ++ io-file;
+  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-file io-image io-json io-pandas io grpc-reflection
-      grpc-channelz monitor-otlp tracing-otlp tracing;
-    triton = [ tritonclient ] ++ tritonclient.optional-dependencies.http ++ tritonclient.optional-dependencies.grpc;
+    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
+      );
   };
 in
 buildPythonPackage {
   pname = "bentoml";
   inherit version;
-  format = "pyproject";
+  pyproject = true;
 
   src = fetchFromGitHub {
     owner = "bentoml";
     repo = "BentoML";
     rev = "refs/tags/v${version}";
-    hash = "sha256-GBKxyjCs02mxYiMK4GhgFUATRCUSVf8mFbWjuPVD7SU=";
+    hash = "sha256-98SVW7f/Yn+NMfS6UIicQcoatMSm4XSJzbuJ0S/p3sg=";
   };
 
-  # https://github.com/bentoml/BentoML/pull/4227 should fix this test
-  postPatch = ''
-    substituteInPlace tests/unit/_internal/utils/test_analytics.py \
-      --replace "requests" "httpx"
-  '';
-
   pythonRelaxDeps = [
+    "cattrs"
+    "nvidia-ml-py"
+    "opentelemetry-api"
+    "opentelemetry-instrumentation-aiohttp-client"
+    "opentelemetry-instrumentation-asgi"
+    "opentelemetry-instrumentation"
+    "opentelemetry-sdk"
     "opentelemetry-semantic-conventions"
+    "opentelemetry-util-http"
   ];
 
-  nativeBuildInputs = [
+  build-system = [
     hatchling
     hatch-vcs
   ];
 
-  propagatedBuildInputs = [
+  dependencies = [
     aiohttp
+    aiosqlite
     attrs
     cattrs
     circus
@@ -134,9 +160,12 @@ buildPythonPackage {
     deepmerge
     fs
     httpx
+    httpx-ws
     inflection
+    inquirerpy
     jinja2
     numpy
+    nvidia-ml-py
     opentelemetry-api
     opentelemetry-instrumentation
     opentelemetry-instrumentation-aiohttp-client
@@ -147,24 +176,24 @@ buildPythonPackage {
     packaging
     pathspec
     pip-requirements-parser
-    pip-tools
     prometheus-client
     psutil
-    nvidia-ml-py
+    pydantic
     python-dateutil
     python-json-logger
     python-multipart
     pyyaml
-    requests
     rich
     schema
     simple-di
     starlette
+    tomli-w
+    uv
     uvicorn
     watchfiles
-  ];
+  ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
 
-  passthru.optional-dependencies = optional-dependencies;
+  inherit optional-dependencies;
 
   pythonImportsCheck = [ "bentoml" ];
 
@@ -185,26 +214,29 @@ buildPythonPackage {
   ];
 
   nativeCheckInputs = [
-    pytestCheckHook
-    pandas
-    pydantic
-    scikit-learn
+    fastapi
+    google-api-python-client
     lxml
     orjson
-    pytest-asyncio
+    pandas
     pillow
-    fastapi
-    starlette
+    pytest-asyncio
+    pytest-xdist
+    pytestCheckHook
+    scikit-learn
   ] ++ optional-dependencies.grpc;
 
-
   meta = with lib; {
     description = "Build Production-Grade AI Applications";
     homepage = "https://github.com/bentoml/BentoML";
     changelog = "https://github.com/bentoml/BentoML/releases/tag/v${version}";
     license = licenses.asl20;
-    maintainers = with maintainers; [ happysalada natsukium ];
-    # https://github.com/bentoml/BentoML/issues/3885
-    broken = versionAtLeast pydantic.version "2";
+    maintainers = with maintainers; [
+      happysalada
+      natsukium
+    ];
+    # AttributeError: 'dict' object has no attribute 'schemas'
+    # https://github.com/bentoml/BentoML/issues/4290
+    broken = versionAtLeast cattrs.version "23.2";
   };
 }