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