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