Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 146 lines 3.4 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 hatchling, 9 10 # dependencies 11 jsonpatch, 12 langsmith, 13 packaging, 14 pydantic, 15 pyyaml, 16 tenacity, 17 typing-extensions, 18 uuid-utils, 19 20 # tests 21 blockbuster, 22 freezegun, 23 grandalf, 24 httpx, 25 langchain-core, 26 langchain-tests, 27 numpy, 28 pytest-asyncio, 29 pytest-mock, 30 pytest-xdist, 31 pytestCheckHook, 32 syrupy, 33 34 # passthru 35 gitUpdater, 36}: 37 38buildPythonPackage rec { 39 pname = "langchain-core"; 40 version = "1.2.7"; 41 pyproject = true; 42 43 src = fetchFromGitHub { 44 owner = "langchain-ai"; 45 repo = "langchain"; 46 tag = "langchain-core==${version}"; 47 hash = "sha256-X/gT+OtA9bQR0vvsfzT3881WUkbRmcY1Ahqk8kT6M9s="; 48 }; 49 50 sourceRoot = "${src.name}/libs/core"; 51 52 build-system = [ hatchling ]; 53 54 dependencies = [ 55 jsonpatch 56 langsmith 57 packaging 58 pydantic 59 pyyaml 60 tenacity 61 typing-extensions 62 uuid-utils 63 ]; 64 65 pythonImportsCheck = [ "langchain_core" ]; 66 67 # avoid infinite recursion 68 doCheck = false; 69 70 nativeCheckInputs = [ 71 blockbuster 72 freezegun 73 grandalf 74 langchain-tests 75 numpy 76 pytest-asyncio 77 pytest-mock 78 pytest-xdist 79 pytestCheckHook 80 syrupy 81 ]; 82 83 enabledTestPaths = [ "tests/unit_tests" ]; 84 85 passthru = { 86 tests.pytest = langchain-core.overridePythonAttrs (_: { 87 doCheck = true; 88 }); 89 # python updater script sets the wrong tag 90 skipBulkUpdate = true; 91 updateScript = gitUpdater { 92 rev-prefix = "langchain-core=="; 93 }; 94 }; 95 96 disabledTests = [ 97 # flaky, sometimes fail to strip uuid from AIMessageChunk before comparing to test value 98 "test_map_stream" 99 # Compares with machine-specific timings 100 "test_rate_limit" 101 # flaky: assert (1726352133.7419367 - 1726352132.2697523) < 1 102 "test_benchmark_model" 103 104 # TypeError: exceptions must be derived from Warning, not <class 'NoneType'> 105 "test_chat_prompt_template_variable_names" 106 "test_create_model_v2" 107 108 # Comparison with magic strings 109 "test_prompt_with_chat_model" 110 "test_prompt_with_chat_model_async" 111 "test_prompt_with_llm" 112 "test_prompt_with_llm_parser" 113 "test_prompt_with_llm_and_async_lambda" 114 "test_prompt_with_chat_model_and_parser" 115 "test_combining_sequences" 116 117 # AssertionError: assert [+ received] == [- snapshot] 118 "test_chat_input_schema" 119 # AssertionError: assert {'$defs': {'D...ype': 'array'} == {'$defs': {'D...ype': 'array'} 120 "test_schemas" 121 # AssertionError: assert [+ received] == [- snapshot] 122 "test_graph_sequence_map" 123 "test_representation_of_runnables" 124 ] 125 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 126 # Langchain-core the following tests due to the test comparing execution time with magic values. 127 "test_queue_for_streaming_via_sync_call" 128 "test_same_event_loop" 129 # Comparisons with magic numbers 130 "test_rate_limit_ainvoke" 131 "test_rate_limit_astream" 132 ]; 133 134 disabledTestPaths = [ "tests/unit_tests/runnables/test_runnable_events_v2.py" ]; 135 136 meta = { 137 description = "Building applications with LLMs through composability"; 138 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/core"; 139 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${src.tag}"; 140 license = lib.licenses.mit; 141 maintainers = with lib.maintainers; [ 142 natsukium 143 sarahec 144 ]; 145 }; 146}