Unverified Commit efc67ddb authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

python3Packages.{langchain*,langgraph*}: upgrades and fixes for python 3.14 (#483453)

parents 2b447239 2b771762
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -37,14 +37,14 @@

buildPythonPackage rec {
  pname = "langchain-core";
  version = "1.2.5";
  version = "1.2.7";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "langchain-ai";
    repo = "langchain";
    tag = "langchain-core==${version}";
    hash = "sha256-gHIJO5O9AxtROdDuo2UhdkW6p3+4dOJaO6iKelA26gE=";
    hash = "sha256-X/gT+OtA9bQR0vvsfzT3881WUkbRmcY1Ahqk8kT6M9s=";
  };

  sourceRoot = "${src.name}/libs/core";
+7 −9
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonAtLeast,

  # build-system
  hatchling,
@@ -35,27 +36,20 @@

buildPythonPackage (finalAttrs: {
  pname = "langchain-mongodb";
  version = "0.10.0";
  version = "0.11.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "langchain-ai";
    repo = "langchain-mongodb";
    tag = "libs/langchain-mongodb/v${finalAttrs.version}";
    hash = "sha256-MRvj6RJ6N+u1wA+zkyWhe4tnGaC4FduPl+k7AhBIwLI=";
    hash = "sha256-dO0dASjyNMxnbxZ/ry8lcJxedPdrv6coYiTjOcaT8/0=";
  };

  sourceRoot = "${finalAttrs.src.name}/libs/langchain-mongodb";

  build-system = [ hatchling ];

  pythonRelaxDeps = [
    # Each component release requests the exact latest core.
    # That prevents us from updating individual components.
    "langchain-core"
    "numpy"
  ];

  dependencies = [
    langchain
    langchain-classic
@@ -91,6 +85,10 @@ buildPythonPackage (finalAttrs: {
  pytestFlags = [
    # DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated
    "-Wignore::DeprecationWarning"
  ]
  ++ lib.optionals (pythonAtLeast "3.14") [
    # UserWarning: Core Pydantic V1 functionality isn't compatible with Python 3.14
    "-Wignore::UserWarning"
  ];

  pythonImportsCheck = [ "langchain_mongodb" ];
+17 −17
Original line number Diff line number Diff line
@@ -9,20 +9,18 @@
  # dependencies
  httpx,
  langchain-core,
  syrupy,
  pytest-benchmark,
  pytest-codspeed,
  numpy,
  pytest-asyncio,
  pytest-recording,
  pytest-socket,
  syrupy,
  vcrpy,

  # buildInputs
  pytest,
  pytestCheckHook,

  # tests
  numpy,
  pytest-asyncio_0,
  pytest-socket,
  pytestCheckHook,
  pytest-benchmark,

  # passthru
  gitUpdater,
@@ -44,35 +42,37 @@ buildPythonPackage rec {

  build-system = [ hatchling ];

  pythonRemoveDeps = [
    "pytest-benchmark"
    "pytest-codspeed"
  ];

  pythonRelaxDeps = [
    # Each component release requests the exact latest core.
    # That prevents us from updating individual components.
    "langchain-core"
    "numpy"
    "syrupy"
  ];

  dependencies = [
    httpx
    langchain-core
    pytest-asyncio_0
    numpy
    pytest-asyncio
    pytest-benchmark
    pytest-codspeed
    pytest-recording
    pytest-socket
    syrupy
    vcrpy
  ];

  buildInputs = [ pytest ];

  pythonImportsCheck = [ "langchain_tests" ];

  nativeBuildInputs = [
    numpy
    pytestCheckHook
  ];

  disabledTestMarks = [
    "benchmark"
  ];

  passthru = {
    # python updater script sets the wrong tag
    skipBulkUpdate = true;
+38 −37
Original line number Diff line number Diff line
@@ -2,41 +2,40 @@
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,

  # build-system
  hatchling,

  # dependencies
  aiohttp,
  async-timeout,
  langchain-core,
  langchain-text-splitters,
  langgraph,
  langsmith,
  numpy,
  pydantic,
  pyyaml,
  requests,
  sqlalchemy,
  tenacity,

  # Optional dependencies
  langchain-anthropic,
  langchain-aws,
  langchain-community,
  langchain-deepseek,
  langchain-fireworks,
  langchain-google-genai,
  langchain-groq,
  langchain-huggingface,
  langchain-mistralai,
  langchain-ollama,
  langchain-openai,
  langchain-perplexity,
  langchain-xai,

  # runtime
  runtimeShell,

  # tests
  blockbuster,
  freezegun,
  httpx,
  langchain-tests,
  lark,
  pandas,
  pytest-asyncio,
  pytest-mock,
  pytest-socket,
  pytest-xdist,
  pytestCheckHook,
  requests-mock,
  responses,
  syrupy,
  toml,

@@ -46,14 +45,14 @@

buildPythonPackage rec {
  pname = "langchain";
  version = "1.2.0";
  version = "1.2.7";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "langchain-ai";
    repo = "langchain";
    tag = "langchain==${version}";
    hash = "sha256-DximXCwrDSUVXZenUrubuGcxdnRCPCPMgdW9UJnkGnE=";
    hash = "sha256-vwd8FoXeMLQyFcEViXx/3LqpNieyp4HHevMAv2AxNVY=";
  };

  sourceRoot = "${src.name}/libs/langchain_v1";
@@ -74,37 +73,38 @@ buildPythonPackage rec {
  ];

  dependencies = [
    aiohttp
    langchain-core
    langchain-text-splitters
    langgraph
    langsmith
    numpy
    pydantic
    pyyaml
    requests
    sqlalchemy
    tenacity
  ]
  ++ lib.optional (pythonOlder "3.11") async-timeout;
  ];

  optional-dependencies = {
    numpy = [ numpy ];
    anthropic = [ langchain-anthropic ];
    aws = [ langchain-aws ];
    # azure-ai = [langchain-azure-ai];
    community = [ langchain-community ];
    deepseek = [ langchain-deepseek ];
    fireworks = [ langchain-fireworks ];
    google-genai = [ langchain-google-genai ];
    # google-vertexai = [langchain-google-vertexai];
    groq = [ langchain-groq ];
    huggingface = [ langchain-huggingface ];
    mistralai = [ langchain-mistralai ];
    ollama = [ langchain-ollama ];
    openai = [ langchain-openai ];
    perplexity = [ langchain-perplexity ];
    # together = [langchain-together];
    xai = [ langchain-xai ];
  };

  nativeCheckInputs = [
    blockbuster
    freezegun
    httpx
    lark
    langchain-tests
    pandas
    # langchain-openai -- causes recursion error
    pytest-asyncio
    pytest-mock
    pytest-socket
    pytest-xdist
    pytestCheckHook
    requests-mock
    responses
    syrupy
    toml
  ];
@@ -113,6 +113,7 @@ buildPythonPackage rec {
    "--only-core"
  ];

  # Note: Not testing with optional dependencies due to mutual recursion
  enabledTestPaths = [
    # integration_tests require network access, database access and require `OPENAI_API_KEY`, etc.
    "tests/unit_tests"
+2 −2
Original line number Diff line number Diff line
@@ -31,14 +31,14 @@
# It exists so the langgraph team can iterate on it without having to rebuild langgraph.
buildPythonPackage rec {
  pname = "langgraph-prebuilt";
  version = "1.0.6";
  version = "1.0.7";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "langchain-ai";
    repo = "langgraph";
    tag = "prebuilt==${version}";
    hash = "sha256-IE9Y+kFkDN49SuwvTNwa2kK+Hig18sJPZmZCqHUP3DM=";
    hash = "sha256-gwug+eVzFa0mL+dvASHQ/cLq4/nIzl6CvigPIep7v1E=";
  };

  sourceRoot = "${src.name}/libs/prebuilt";
Loading