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