summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/langchain-classic/default.nix
blob: 55b1d910d58f558ae4c801fb021e20ed099212e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  hatchling,

  # dependencies
  langchain-core,
  langchain-text-splitters,
  langsmith,
  pydantic,
  pyyaml,
  requests,
  sqlalchemy,

  # tests
  blockbuster,
  cffi,
  freezegun,
  langchain-openai,
  langchain-tests,
  lark,
  numpy,
  packaging,
  pandas,
  pytest-asyncio,
  pytest-dotenv,
  pytest-mock,
  pytest-socket,
  pytest-xdist,
  pytestCheckHook,
  requests-mock,
  responses,
  syrupy,
  toml,

  # update
  gitUpdater,
}:

buildPythonPackage rec {
  pname = "langchain-classic";
  version = "1.0.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "langchain-ai";
    repo = "langchain";
    tag = "langchain-classic==${version}";
    hash = "sha256-4DlKOxt5OoPm38szMEJpw6gDl247eRsx4LZpofUKpUk=";
  };

  sourceRoot = "${src.name}/libs/langchain";

  build-system = [ hatchling ];

  pythonRelaxDeps = [
    # Each component release requests the exact latest core.
    "langchain-core"
  ];

  dependencies = [
    langchain-core
    langchain-text-splitters
    langsmith
    pydantic
    pyyaml
    requests
    sqlalchemy
  ];

  nativeCheckInputs = [
    blockbuster
    cffi
    freezegun
    langchain-core
    langchain-openai
    langchain-tests
    langchain-text-splitters
    lark
    numpy
    packaging
    pandas
    pytest-asyncio
    pytest-dotenv
    pytest-mock
    pytest-socket
    pytest-xdist
    pytestCheckHook
    requests-mock
    responses
    syrupy
    toml
  ];

  enabledTestPaths = [
    # integration_tests require network access, database access and require `OPENAI_API_KEY`, etc.
    "tests/unit_tests"
  ];

  disabledTests = [
    # Network access (web.example.com)
    "test_socket_disabled"
  ];

  # Bulk updater selects wrong tag
  passthru = {
    skipBulkUpdate = true;
    updateScript = gitUpdater {
      rev-prefix = "langchain-classic==";
    };
  };

  pythonImportsCheck = [ "langchain_classic" ];

  meta = {
    description = "Classic (0.x) compatibility layer for LangChain";
    homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/langchain";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ sarahec ];
  };
}