1{
2 lib,
3 authlib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 grpcio,
7 grpcio-health-checking,
8 grpcio-tools,
9 httpx,
10 pydantic,
11 pythonOlder,
12 requests,
13 setuptools-scm,
14 validators,
15 pytestCheckHook,
16 numpy,
17 pytest-httpserver,
18 pandas,
19 polars,
20 h5py,
21 litestar,
22 pytest-asyncio,
23 flask,
24 fastapi,
25}:
26
27buildPythonPackage rec {
28 pname = "weaviate-client";
29 version = "4.12.0";
30 pyproject = true;
31
32 disabled = pythonOlder "3.12";
33
34 src = fetchFromGitHub {
35 owner = "weaviate";
36 repo = "weaviate-python-client";
37 tag = "v${version}";
38 hash = "sha256-7Mg6d7gbBQfbkxsZI6aGVpfdhBS6MwmK6cl/8koy46k=";
39 };
40
41 pythonRelaxDeps = [
42 "httpx"
43 "validators"
44 "authlib"
45 ];
46
47 build-system = [ setuptools-scm ];
48
49 dependencies = [
50 authlib
51 grpcio
52 flask
53 grpcio-health-checking
54 grpcio-tools
55 h5py
56 httpx
57 pydantic
58 numpy
59 litestar
60 fastapi
61 polars
62 requests
63 pandas
64 validators
65 ];
66
67 nativeCheckInputs = [
68 pytest-httpserver
69 pytest-asyncio
70 pytestCheckHook
71 ];
72
73 preCheck = ''
74 export HOME=$(mktemp -d)
75 sed -i '/raw.githubusercontent.com/,+1d' test/test_util.py
76 substituteInPlace pytest.ini \
77 --replace-fail "--benchmark-skip" ""
78 rm -rf test/test_embedded.py # Need network
79 '';
80
81 disabledTests = [
82 # Need network
83 "test_bearer_token"
84 "test_auth_header_with_catchall_proxy"
85 "test_token_refresh_timeout"
86 "test_with_simple_auth_no_oidc_via_api_key"
87 "test_client_with_extra_options"
88 ];
89
90 pytestFlagsArray = [
91 "test"
92 "mock_tests"
93 ];
94
95 __darwinAllowLocalNetworking = true;
96
97 pythonImportsCheck = [ "weaviate" ];
98
99 meta = {
100 description = "Python native client for easy interaction with a Weaviate instance";
101 homepage = "https://github.com/weaviate/weaviate-python-client";
102 changelog = "https://github.com/weaviate/weaviate-python-client/releases/tag/${src.tag}";
103 license = lib.licenses.mit;
104 maintainers = with lib.maintainers; [ happysalada ];
105 badPlatforms = [
106 # weaviate.exceptions.WeaviateGRPCUnavailableError
107 lib.systems.inspect.patterns.isDarwin
108 ];
109 };
110}