nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonAtLeast,
6
7 # build-system
8 hatchling,
9
10 # dependencies
11 langchain,
12 langchain-classic,
13 langchain-core,
14 langchain-text-splitters,
15 lark,
16 numpy,
17 pymongo,
18 pymongo-search-utils,
19
20 # test
21 freezegun,
22 httpx,
23 langchain-community,
24 langchain-ollama,
25 langchain-openai,
26 langchain-tests,
27 mongomock,
28 pytest-asyncio,
29 pytestCheckHook,
30 pytest-mock,
31 syrupy,
32
33 # passthru
34 gitUpdater,
35}:
36
37buildPythonPackage (finalAttrs: {
38 pname = "langchain-mongodb";
39 version = "0.11.0";
40 pyproject = true;
41
42 src = fetchFromGitHub {
43 owner = "langchain-ai";
44 repo = "langchain-mongodb";
45 tag = "libs/langchain-mongodb/v${finalAttrs.version}";
46 hash = "sha256-dO0dASjyNMxnbxZ/ry8lcJxedPdrv6coYiTjOcaT8/0=";
47 };
48
49 sourceRoot = "${finalAttrs.src.name}/libs/langchain-mongodb";
50
51 build-system = [ hatchling ];
52
53 dependencies = [
54 langchain
55 langchain-classic
56 langchain-core
57 langchain-text-splitters
58 numpy
59 pymongo
60 pymongo-search-utils
61 ];
62
63 nativeCheckInputs = [
64 freezegun
65 httpx
66 langchain-community
67 langchain-ollama
68 langchain-openai
69 langchain-tests
70 lark
71 mongomock
72 pytest-asyncio
73 pytestCheckHook
74 pytest-mock
75 syrupy
76 ];
77
78 enabledTestPaths = [ "tests/unit_tests" ];
79
80 disabledTestPaths = [
81 # Expects a MongoDB cluster and are very slow
82 "tests/unit_tests/test_index.py"
83 ];
84
85 pytestFlags = [
86 # DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated
87 "-Wignore::DeprecationWarning"
88 ]
89 ++ lib.optionals (pythonAtLeast "3.14") [
90 # UserWarning: Core Pydantic V1 functionality isn't compatible with Python 3.14
91 "-Wignore::UserWarning"
92 ];
93
94 pythonImportsCheck = [ "langchain_mongodb" ];
95
96 passthru = {
97 # python updater script sets the wrong tag
98 skipBulkUpdate = true;
99 updateScript = gitUpdater {
100 rev-prefix = "libs/langchain-mongodb/v";
101 };
102 };
103
104 meta = {
105 changelog = "https://github.com/langchain-ai/langchain-mongodb/releases/tag/${finalAttrs.src.tag}";
106 description = "Integration package connecting MongoDB and LangChain";
107 homepage = "https://github.com/langchain-ai/langchain-mongodb";
108 license = lib.licenses.mit;
109 maintainers = with lib.maintainers; [
110 natsukium
111 sarahec
112 ];
113 };
114})