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 (finalAttrs: {
35 pname = "langchain-huggingface";
36 version = "1.2.1";
37 pyproject = true;
38
39 src = fetchFromGitHub {
40 owner = "langchain-ai";
41 repo = "langchain";
42 tag = "langchain-huggingface==${finalAttrs.version}";
43 hash = "sha256-I6n7UNEbGqlyzT663k7+YpcaB/+rE9RlkqIToupoEyY=";
44 };
45
46 sourceRoot = "${finalAttrs.src.name}/libs/partners/huggingface";
47
48 build-system = [ hatchling ];
49
50 dependencies = [
51 huggingface-hub
52 langchain-core
53 sentence-transformers
54 tokenizers
55 transformers
56 ];
57
58 nativeCheckInputs = [
59 freezegun
60 httpx
61 lark
62 pandas
63 pytest-asyncio
64 pytest-mock
65 pytest-socket
66 pytestCheckHook
67 requests-mock
68 responses
69 syrupy
70 toml
71 ];
72
73 enabledTestPaths = [ "tests/unit_tests" ];
74
75 disabledTests = [
76 # Requires a circular dependency on langchain
77 "test_init_chat_model_huggingface"
78 ];
79
80 pythonImportsCheck = [ "langchain_huggingface" ];
81
82 passthru = {
83 # python updater script sets the wrong tag
84 skipBulkUpdate = true;
85 updateScript = gitUpdater {
86 rev-prefix = "langchain-huggingface==";
87 };
88 };
89
90 meta = {
91 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${finalAttrs.src.tag}";
92 description = "Integration package connecting Huggingface related classes and LangChain";
93 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/huggingface";
94 license = lib.licenses.mit;
95 maintainers = with lib.maintainers; [
96 natsukium
97 sarahec
98 ];
99 };
100})