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 huggingface-hub,
11 langchain-core,
12 sentence-transformers,
13 tokenizers,
14 transformers,
15
16 # tests
17 freezegun,
18 httpx,
19 lark,
20 pandas,
21 pytest-asyncio,
22 pytest-mock,
23 pytest-socket,
24 pytestCheckHook,
25 requests-mock,
26 responses,
27 syrupy,
28 toml,
29
30 # passthru
31 gitUpdater,
32}:
33
34buildPythonPackage rec {
35 pname = "langchain-huggingface";
36 version = "1.2.0";
37 pyproject = true;
38
39 src = fetchFromGitHub {
40 owner = "langchain-ai";
41 repo = "langchain";
42 tag = "langchain-huggingface==${version}";
43 hash = "sha256-ucKhuu8J6XudIyjCniJixFq79wPfoCnNBUd6r1U2ieI=";
44 };
45
46 sourceRoot = "${src.name}/libs/partners/huggingface";
47
48 build-system = [ hatchling ];
49
50 pythonRelaxDeps = [
51 # Each component release requests the exact latest core.
52 # That prevents us from updating individual components.
53 "langchain-core"
54 ];
55
56 dependencies = [
57 huggingface-hub
58 langchain-core
59 sentence-transformers
60 tokenizers
61 transformers
62 ];
63
64 nativeCheckInputs = [
65 freezegun
66 httpx
67 lark
68 pandas
69 pytest-asyncio
70 pytest-mock
71 pytest-socket
72 pytestCheckHook
73 requests-mock
74 responses
75 syrupy
76 toml
77 ];
78
79 enabledTestPaths = [ "tests/unit_tests" ];
80
81 disabledTests = [
82 # Requires a circular dependency on langchain
83 "test_init_chat_model_huggingface"
84 ];
85
86 pythonImportsCheck = [ "langchain_huggingface" ];
87
88 passthru = {
89 # python updater script sets the wrong tag
90 skipBulkUpdate = true;
91 updateScript = gitUpdater {
92 rev-prefix = "langchain-huggingface==";
93 };
94 };
95
96 meta = {
97 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${src.tag}";
98 description = "Integration package connecting Huggingface related classes and LangChain";
99 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/huggingface";
100 license = lib.licenses.mit;
101 maintainers = with lib.maintainers; [
102 natsukium
103 sarahec
104 ];
105 };
106}