1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 pdm-backend,
8
9 # dependencies
10 httpx,
11 langchain-core,
12 syrupy,
13 pytest-benchmark,
14 pytest-codspeed,
15 pytest-recording,
16 vcrpy,
17
18 # buildInputs
19 pytest,
20
21 # tests
22 numpy,
23 pytest-asyncio_0,
24 pytest-socket,
25 pytestCheckHook,
26
27 # passthru
28 gitUpdater,
29}:
30
31buildPythonPackage rec {
32 pname = "langchain-tests";
33 version = "0.3.21";
34 pyproject = true;
35
36 src = fetchFromGitHub {
37 owner = "langchain-ai";
38 repo = "langchain";
39 tag = "langchain-tests==${version}";
40 hash = "sha256-CufnUFhYTENuq4/32u0w3UZb7TdZxEpshyQqLH6NEZo=";
41 };
42
43 sourceRoot = "${src.name}/libs/standard-tests";
44
45 build-system = [ pdm-backend ];
46
47 pythonRelaxDeps = [
48 # Each component release requests the exact latest core.
49 # That prevents us from updating individual components.
50 "langchain-core"
51 "numpy"
52 ];
53
54 dependencies = [
55 httpx
56 langchain-core
57 pytest-asyncio_0
58 pytest-benchmark
59 pytest-codspeed
60 pytest-recording
61 pytest-socket
62 syrupy
63 vcrpy
64 ];
65
66 buildInputs = [ pytest ];
67
68 pythonImportsCheck = [ "langchain_tests" ];
69
70 nativeBuildInputs = [
71 numpy
72 pytestCheckHook
73 ];
74
75 passthru = {
76 # python updater script sets the wrong tag
77 skipBulkUpdate = true;
78 updateScript = gitUpdater {
79 rev-prefix = "langchain-tests==";
80 };
81 };
82
83 meta = {
84 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${src.tag}";
85 description = "Build context-aware reasoning applications";
86 homepage = "https://github.com/langchain-ai/langchain";
87 license = lib.licenses.mit;
88 maintainers = with lib.maintainers; [
89 natsukium
90 sarahec
91 ];
92 };
93}