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 httpx,
11 langchain-core,
12 numpy,
13 pytest-asyncio,
14 pytest-recording,
15 pytest-socket,
16 syrupy,
17 vcrpy,
18
19 # buildInputs
20 pytestCheckHook,
21
22 # tests
23 pytest-benchmark,
24
25 # passthru
26 gitUpdater,
27}:
28
29buildPythonPackage rec {
30 pname = "langchain-tests";
31 version = "1.1.2";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "langchain-ai";
36 repo = "langchain";
37 tag = "langchain-tests==${version}";
38 hash = "sha256-g5s7zL4l/kIUoIu7/3+Ve3SXW3O9tj8f2N3bZ0gbBts=";
39 };
40
41 sourceRoot = "${src.name}/libs/standard-tests";
42
43 build-system = [ hatchling ];
44
45 pythonRemoveDeps = [
46 "pytest-benchmark"
47 "pytest-codspeed"
48 ];
49
50 pythonRelaxDeps = [
51 "pytest"
52 "syrupy"
53 "vcrpy"
54 ];
55
56 dependencies = [
57 httpx
58 langchain-core
59 numpy
60 pytest-asyncio
61 pytest-benchmark
62 pytest-recording
63 pytest-socket
64 syrupy
65 vcrpy
66 ];
67
68 pythonImportsCheck = [ "langchain_tests" ];
69
70 nativeBuildInputs = [
71 pytestCheckHook
72 ];
73
74 disabledTestMarks = [
75 "benchmark"
76 ];
77
78 passthru = {
79 # python updater script sets the wrong tag
80 skipBulkUpdate = true;
81 updateScript = gitUpdater {
82 rev-prefix = "langchain-tests==";
83 };
84 };
85
86 meta = {
87 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${src.tag}";
88 description = "Build context-aware reasoning applications";
89 homepage = "https://github.com/langchain-ai/langchain";
90 license = lib.licenses.mit;
91 maintainers = with lib.maintainers; [
92 natsukium
93 sarahec
94 ];
95 };
96}