Home / File/ test_imports.py — langchain Source File

test_imports.py — langchain Source File

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

Entity Profile

Dependency Diagram

graph LR
  c930462a_2352_e23e_140a_b6596d8ee5ae["test_imports.py"]
  f02b765e_0b79_f1fa_161f_0492d5c24a46["subprocess"]
  c930462a_2352_e23e_140a_b6596d8ee5ae --> f02b765e_0b79_f1fa_161f_0492d5c24a46
  d76a28c2_c3ab_00a8_5208_77807a49449d["sys"]
  c930462a_2352_e23e_140a_b6596d8ee5ae --> d76a28c2_c3ab_00a8_5208_77807a49449d
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  c930462a_2352_e23e_140a_b6596d8ee5ae --> 120e2591_3e15_b895_72b6_cb26195e40a6
  e85cc09a_55c8_b775_4454_f3a6771761b9["pytest_benchmark.fixture"]
  c930462a_2352_e23e_140a_b6596d8ee5ae --> e85cc09a_55c8_b775_4454_f3a6771761b9
  style c930462a_2352_e23e_140a_b6596d8ee5ae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import subprocess
import sys

import pytest
from pytest_benchmark.fixture import BenchmarkFixture


@pytest.mark.parametrize(
    "import_path",
    [
        pytest.param(
            "from langchain_core.messages import HumanMessage", id="HumanMessage"
        ),
        pytest.param("from langchain_core.tools import tool", id="tool"),
        pytest.param(
            "from langchain_core.callbacks import CallbackManager", id="CallbackManager"
        ),
        pytest.param("from langchain_core.runnables import Runnable", id="Runnable"),
        pytest.param(
            "from langchain_core.language_models import BaseChatModel",
            id="BaseChatModel",
        ),
        pytest.param(
            "from langchain_core.prompts import ChatPromptTemplate",
            id="ChatPromptTemplate",
        ),
        pytest.param("from langchain_core.documents import Document", id="Document"),
        pytest.param(
            "from langchain_core.vectorstores import InMemoryVectorStore",
            id="InMemoryVectorStore",
        ),
        pytest.param(
            "from langchain_core.runnables import RunnableLambda",
            id="RunnableLambda",
        ),
        pytest.param(
            "from langchain_core.tracers import LangChainTracer",
            id="LangChainTracer",
        ),
        pytest.param(
            "from langchain_core.output_parsers import PydanticOutputParser",
            id="PydanticOutputParser",
        ),
        pytest.param(
            "from langchain_core.rate_limiters import InMemoryRateLimiter",
            id="InMemoryRateLimiter",
        ),
    ],
)
@pytest.mark.benchmark
def test_import_time(benchmark: BenchmarkFixture, import_path: str) -> None:
    @benchmark  # type: ignore[untyped-decorator]
    def import_in_subprocess() -> None:
        subprocess.run([sys.executable, "-c", import_path], check=True)

Subdomains

Functions

Dependencies

  • pytest
  • pytest_benchmark.fixture
  • subprocess
  • sys

Frequently Asked Questions

What does test_imports.py do?
test_imports.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_imports.py?
test_imports.py defines 1 function(s): test_import_time.
What does test_imports.py depend on?
test_imports.py imports 4 module(s): pytest, pytest_benchmark.fixture, subprocess, sys.
Where is test_imports.py in the architecture?
test_imports.py is located at libs/core/tests/benchmarks/test_imports.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/tests/benchmarks).

Analyze Your Own Codebase

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

Try Supermodel Free