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