Home / File/ test_dependencies.py — langchain Source File

test_dependencies.py — langchain Source File

Architecture documentation for test_dependencies.py, a python file in the langchain codebase. 6 imports, 0 dependents.

File python CoreAbstractions MessageSchema 6 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  aefb162b_4258_1230_d7d9_5e64d0e8c967["test_dependencies.py"]
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  aefb162b_4258_1230_d7d9_5e64d0e8c967 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  b6ee5de5_719a_eeb5_1e11_e9c63bc22ef8["pathlib"]
  aefb162b_4258_1230_d7d9_5e64d0e8c967 --> b6ee5de5_719a_eeb5_1e11_e9c63bc22ef8
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  aefb162b_4258_1230_d7d9_5e64d0e8c967 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  aefb162b_4258_1230_d7d9_5e64d0e8c967 --> 120e2591_3e15_b895_72b6_cb26195e40a6
  87110cc5_7f7f_9e93_8ec9_2c3a2ae425fe["toml"]
  aefb162b_4258_1230_d7d9_5e64d0e8c967 --> 87110cc5_7f7f_9e93_8ec9_2c3a2ae425fe
  6efe7ca1_6cc7_f0eb_d477_b2345bbf8903["packaging.requirements"]
  aefb162b_4258_1230_d7d9_5e64d0e8c967 --> 6efe7ca1_6cc7_f0eb_d477_b2345bbf8903
  style aefb162b_4258_1230_d7d9_5e64d0e8c967 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""A unit test meant to catch accidental introduction of non-optional dependencies."""

from collections.abc import Mapping
from pathlib import Path
from typing import Any

import pytest
import toml
from packaging.requirements import Requirement

HERE = Path(__file__).parent

PYPROJECT_TOML = HERE / "../../pyproject.toml"


@pytest.fixture
def uv_conf() -> dict[str, Any]:
    """Load the pyproject.toml file."""
    with PYPROJECT_TOML.open() as f:
        return toml.load(f)


def test_required_dependencies(uv_conf: Mapping[str, Any]) -> None:
    """A test that checks if a new non-optional dependency is being introduced.

    If this test is triggered, it means that a contributor is trying to introduce a new
    required dependency. This should be avoided in most situations.
    """
    # Get the dependencies from the [tool.poetry.dependencies] section
    dependencies = uv_conf["project"]["dependencies"]
    required_dependencies = {Requirement(dep).name for dep in dependencies}

    assert sorted(required_dependencies) == sorted(
        [
            "langchain-core",
            "langgraph",
            "pydantic",
        ]
    )

Subdomains

Dependencies

  • collections.abc
  • packaging.requirements
  • pathlib
  • pytest
  • toml
  • typing

Frequently Asked Questions

What does test_dependencies.py do?
test_dependencies.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in test_dependencies.py?
test_dependencies.py defines 2 function(s): test_required_dependencies, uv_conf.
What does test_dependencies.py depend on?
test_dependencies.py imports 6 module(s): collections.abc, packaging.requirements, pathlib, pytest, toml, typing.
Where is test_dependencies.py in the architecture?
test_dependencies.py is located at libs/langchain_v1/tests/unit_tests/test_dependencies.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/langchain_v1/tests/unit_tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free