1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 nix-update-script, 6 7 # build-system 8 pdm-backend, 9 10 # dependencies 11 langchain-core, 12 13 # tests 14 httpx, 15 pytest-asyncio, 16 pytestCheckHook, 17}: 18 19buildPythonPackage rec { 20 pname = "langchain-text-splitters"; 21 version = "0.3.8"; 22 pyproject = true; 23 24 src = fetchFromGitHub { 25 owner = "langchain-ai"; 26 repo = "langchain"; 27 tag = "langchain-text-splitters==${version}"; 28 hash = "sha256-Ia3ZZ94uLZUVr1/w4HLPZLM6u8leA4OJtAwUf7eSAE0="; 29 }; 30 31 sourceRoot = "${src.name}/libs/text-splitters"; 32 33 build-system = [ pdm-backend ]; 34 35 pythonRelaxDeps = [ 36 # Each component release requests the exact latest core. 37 # That prevents us from updating individul components. 38 "langchain-core" 39 ]; 40 41 dependencies = [ langchain-core ]; 42 43 pythonImportsCheck = [ "langchain_text_splitters" ]; 44 45 nativeCheckInputs = [ 46 httpx 47 pytest-asyncio 48 pytestCheckHook 49 ]; 50 51 pytestFlagsArray = [ "tests/unit_tests" ]; 52 53 passthru.updateScript = nix-update-script { 54 extraArgs = [ 55 "--version-regex" 56 "^langchain-test-splitters==([0-9.]+)$" 57 ]; 58 }; 59 60 meta = { 61 changelog = "https://github.com/langchain-ai/langchain/releases/tag/langchain-text-splitters==${version}"; 62 description = "LangChain utilities for splitting into chunks a wide variety of text documents"; 63 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/text-splitters"; 64 license = lib.licenses.mit; 65 maintainers = with lib.maintainers; [ 66 fab 67 sarahec 68 ]; 69 }; 70}