Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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.72";
34 pyproject = true;
35
36 src = fetchFromGitHub {
37 owner = "langchain-ai";
38 repo = "langchain";
39 tag = "langchain-core==${version}";
40 hash = "sha256-Q2uGMiODUtwkPdOyuSqp8vqjlLjiXk75QjXp7rr20tc=";
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.updateScript = gitUpdater {
76 rev-prefix = "langchain-tests==";
77 };
78
79 meta = {
80 description = "Build context-aware reasoning applications";
81 homepage = "https://github.com/langchain-ai/langchain";
82 license = lib.licenses.mit;
83 maintainers = with lib.maintainers; [
84 natsukium
85 sarahec
86 ];
87 };
88}