1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 pdm-backend, 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 = "0.3.1"; 37 pyproject = true; 38 39 src = fetchFromGitHub { 40 owner = "langchain-ai"; 41 repo = "langchain"; 42 tag = "langchain-huggingface==${version}"; 43 hash = "sha256-nae7KwCKjkvenOO8vErxFQStHolc+N8EUuK6U8r48Kc="; 44 }; 45 46 sourceRoot = "${src.name}/libs/partners/huggingface"; 47 48 build-system = [ pdm-backend ]; 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 pythonImportsCheck = [ "langchain_huggingface" ]; 82 83 passthru = { 84 # python updater script sets the wrong tag 85 skipBulkUpdate = true; 86 updateScript = gitUpdater { 87 rev-prefix = "langchain-huggingface=="; 88 }; 89 }; 90 91 meta = { 92 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${src.tag}"; 93 description = "Integration package connecting Huggingface related classes and LangChain"; 94 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/huggingface"; 95 license = lib.licenses.mit; 96 maintainers = with lib.maintainers; [ 97 natsukium 98 sarahec 99 ]; 100 }; 101}