1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 bentoml,
6 hatch-fancy-pypi-readme,
7 hatch-vcs,
8 hatchling,
9 anyio,
10 distro,
11 httpx,
12 httpx-auth,
13 openllm-core,
14 soundfile,
15 transformers,
16}:
17
18buildPythonPackage rec {
19 inherit (openllm-core) src version;
20 pname = "openllm-client";
21 pyproject = true;
22
23 disabled = pythonOlder "3.8";
24
25 sourceRoot = "${src.name}/openllm-client";
26
27 postPatch = ''
28 substituteInPlace pyproject.toml \
29 --replace-fail "hatchling==1.18.0" "hatchling" \
30 --replace-fail "hatch-vcs==0.3.0" "hatch-vcs" \
31 --replace-fail "hatch-fancy-pypi-readme==23.1.0" "hatch-fancy-pypi-readme"
32 '';
33
34 build-system = [
35 hatch-fancy-pypi-readme
36 hatch-vcs
37 hatchling
38 ];
39
40 dependencies = [
41 anyio
42 distro
43 httpx
44 openllm-core
45 ];
46
47 optional-dependencies = {
48 grpc = [ bentoml ] ++ bentoml.optional-dependencies.grpc;
49 auth = [ httpx-auth ];
50 agents = [
51 transformers
52 # diffusers
53 soundfile
54 ] ++ transformers.optional-dependencies.agents;
55 full = optional-dependencies.grpc ++ optional-dependencies.agents;
56 };
57
58 # there is no tests
59 doCheck = false;
60
61 pythonImportsCheck = [ "openllm_client" ];
62
63 meta = with lib; {
64 description = "Interacting with OpenLLM HTTP/gRPC server, or any BentoML server";
65 homepage = "https://github.com/bentoml/OpenLLM/tree/main/openllm-client";
66 changelog = "https://github.com/bentoml/OpenLLM/blob/${src.rev}/CHANGELOG.md";
67 license = licenses.asl20;
68 maintainers = with maintainers; [ natsukium ];
69 };
70}