1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6
7 # build-system
8 poetry-core,
9
10 # dependencies
11 boto3,
12 langchain-core,
13 numpy,
14 pydantic,
15
16 # tests
17 langchain-tests,
18 pytest-asyncio,
19 pytestCheckHook,
20}:
21
22buildPythonPackage rec {
23 pname = "langchain-aws";
24 version = "0.2.22";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "langchain-ai";
29 repo = "langchain-aws";
30 tag = "langchain-aws==${version}";
31 hash = "sha256-tEkwa+rpitGxstci754JH5HCqD7+WX0No6ielJJnbxk=";
32 };
33
34 postPatch = ''
35 substituteInPlace pyproject.toml \
36 --replace-fail "--snapshot-warn-unused" "" \
37 --replace-fail "--cov=langchain_aws" ""
38 substituteInPlace tests/unit_tests/{test_standard.py,chat_models/test_bedrock_converse.py} \
39 --replace-fail "langchain_standard_tests" "langchain_tests"
40 '';
41
42 sourceRoot = "${src.name}/libs/aws";
43
44 build-system = [ poetry-core ];
45
46 dependencies = [
47 boto3
48 langchain-core
49 numpy
50 pydantic
51 ];
52
53 pythonRelaxDeps = [
54 # Boto @ 1.35 has outstripped the version requirement
55 "boto3"
56 # Each component release requests the exact latest core.
57 # That prevents us from updating individul components.
58 "langchain-core"
59 ];
60
61 nativeCheckInputs = [
62 langchain-tests
63 pytest-asyncio
64 pytestCheckHook
65 ];
66
67 pytestFlagsArray = [ "tests/unit_tests" ];
68
69 pythonImportsCheck = [ "langchain_aws" ];
70
71 passthru.updateScript = nix-update-script {
72 extraArgs = [
73 "--version-regex"
74 "langchain-aws==([0-9.]+)"
75 ];
76 };
77
78 meta = {
79 changelog = "https://github.com/langchain-ai/langchain-aws/releases/tag/v${version}";
80 description = "Build LangChain application on AWS";
81 homepage = "https://github.com/langchain-ai/langchain-aws/";
82 license = lib.licenses.mit;
83 maintainers = with lib.maintainers; [
84 drupol
85 natsukium
86 sarahec
87 ];
88 };
89}