1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6
7 # build-system
8 pdm-backend,
9
10 # dependencies
11 aiohttp,
12 dataclasses-json,
13 httpx-sse,
14 langchain,
15 langchain-core,
16 langsmith,
17 numpy,
18 pydantic-settings,
19 pyyaml,
20 requests,
21 sqlalchemy,
22 tenacity,
23
24 # tests
25 blockbuster,
26 duckdb,
27 duckdb-engine,
28 httpx,
29 langchain-tests,
30 lark,
31 pandas,
32 pytest-asyncio,
33 pytest-mock,
34 pytestCheckHook,
35 requests-mock,
36 responses,
37 syrupy,
38 toml,
39}:
40
41buildPythonPackage rec {
42 pname = "langchain-community";
43 version = "0.3.24";
44 pyproject = true;
45
46 src = fetchFromGitHub {
47 owner = "langchain-ai";
48 repo = "langchain-community";
49 tag = "libs/community/v${version}";
50 hash = "sha256-4Rcczuz7tCb10HPvO15n48DBKjVBLXNPdRfD4lRKNGk=";
51 };
52
53 sourceRoot = "${src.name}/libs/community";
54
55 build-system = [ pdm-backend ];
56
57 pythonRelaxDeps = [
58 # Each component release requests the exact latest langchain and -core.
59 # That prevents us from updating individul components.
60 "langchain"
61 "langchain-core"
62 "numpy"
63 "pydantic-settings"
64 "tenacity"
65 ];
66
67 pythonRemoveDeps = [
68 "bs4"
69 ];
70
71 dependencies = [
72 aiohttp
73 dataclasses-json
74 httpx-sse
75 langchain
76 langchain-core
77 langsmith
78 numpy
79 pydantic-settings
80 pyyaml
81 requests
82 sqlalchemy
83 tenacity
84 ];
85
86 pythonImportsCheck = [ "langchain_community" ];
87
88 nativeCheckInputs = [
89 blockbuster
90 duckdb
91 duckdb-engine
92 httpx
93 langchain-tests
94 lark
95 pandas
96 pytest-asyncio
97 pytest-mock
98 pytestCheckHook
99 requests-mock
100 responses
101 syrupy
102 toml
103 ];
104
105 pytestFlagsArray = [
106 "tests/unit_tests"
107 ];
108
109 __darwinAllowLocalNetworking = true;
110
111 disabledTests = [
112 # requires bs4, aka BeautifulSoup
113 "test_importable_all"
114 # flaky
115 "test_llm_caching"
116 "test_llm_caching_async"
117 ];
118
119 disabledTestPaths = [
120 # depends on Pydantic v1 notations, will not load
121 "tests/unit_tests/document_loaders/test_gitbook.py"
122 ];
123
124 passthru.updateScript = nix-update-script {
125 extraArgs = [
126 "--version-regex"
127 "libs/community/v([0-9.]+)"
128 ];
129 };
130
131 meta = {
132 description = "Community contributed LangChain integrations";
133 homepage = "https://github.com/langchain-ai/langchain-community";
134 changelog = "https://github.com/langchain-ai/langchain-community/releases/tag/libs%2Fcommunity%2fv${version}";
135 license = lib.licenses.mit;
136 maintainers = with lib.maintainers; [
137 natsukium
138 sarahec
139 ];
140 };
141}