langchain-ai/langchain
Tooling
A reference for the build, lint, test, and maintenance tools the repo depends on.
uv
Every package uses uv for dependency management. Each package directory has its own uv.lock and is independently resolvable. Top-level commands you'll use:
uv sync --all-groups # install everything declared in pyproject.toml
uv sync --group test # install just one dependency group
uv run pytest ... # run a command inside the locked environment
uv build # build a wheel + sdist via hatchling
uv lock --upgrade-package X # bump a single dependency's pinEditable cross-package links live under [tool.uv.sources] in each pyproject.toml. For example, libs/langchain_v1/pyproject.toml declares:
[tool.uv.sources]
langchain-core = { path = "../core", editable = true }
langchain-openai = { path = "../partners/openai", editable = true }When you uv sync in libs/langchain_v1/, those sibling directories are installed in editable mode automatically.
make
Most packages ship a Makefile with these targets:
| Target | What it does |
|---|---|
make test |
Unit tests (pytest tests/unit_tests) |
make test_watch |
pytest-watcher for TDD |
make integration_test |
Integration tests (network) |
make benchmark |
pytest-benchmark (only some packages) |
make lint |
ruff check, ruff format --check, optionally mypy |
make format |
ruff format, ruff check --fix |
make spell_check |
Spell-check docstrings (some packages) |
The exact targets vary; run make help if a Makefile defines it.
ruff
ruff handles both linting and formatting. Configuration lives in each pyproject.toml under [tool.ruff]:
line-length = 100select = ["ALL"]with a small ignore listban-relative-imports = "all"pydocstyle.convention = "google"- Per-file overrides for tests, scripts, and a few legacy modules
Common commands:
uv run --group lint ruff check .
uv run --group lint ruff format .
uv run --group lint ruff format --check .
uv run --group lint ruff check --fix .mypy
Static type-checking. langchain-core and langchain use strict = true with enable_error_code = "deprecated". Run it from the package root:
uv run --group lint mypy .Some test directories opt out via [tool.mypy.overrides] — see libs/langchain_v1/pyproject.toml for examples.
pytest
The testing framework. Each package's [tool.pytest.ini_options] sets:
addopts = "--strict-markers --strict-config --durations=5 --snapshot-warn-unused -vv"
asyncio_mode = "auto"Custom markers used across the repo:
requires— mark tests as needing a specific optional dependencyscheduled— mark tests that only run in scheduled CIcompile— placeholder used by integration test compile checksbenchmark— performance benchmarks
langchain-profiles CLI
Lives at libs/model-profiles/langchain_model_profiles/cli.py. Pulls model capability data (context window, multimodal support, tool support, pricing) from models.dev and writes JSON into a partner's data/ directory.
cd libs/model-profiles
uv run langchain-profiles refresh \
--provider openai \
--data-dir ../partners/openai/langchain_openai/dataThe --data-dir argument must point to the directory containing profile_augmentations.toml, not the partner package root. To target a sibling repo (e.g. langchain-google) use echo y | to confirm the cross-directory write:
echo y | uv run langchain-profiles refresh \
--provider google \
--data-dir /path/to/langchain-google/libs/genai/langchain_google_genai/dataThe _refresh_model_profiles.yml and refresh_model_profiles.yml GitHub workflows run this on a schedule.
pre-commit
.pre-commit-config.yaml configures the project's pre-commit hooks. It runs basic hygiene (trailing whitespace, large files), ruff format/check, and a few actionlint checks for the GitHub workflows. Install with:
pipx install pre-commit
pre-commit installhatchling
Every package's build backend (pyproject.toml's [build-system]). uv build invokes hatchling, which produces a wheel and an sdist in dist/.
actionlint and pinned actions
The repo requires GitHub Actions to be pinned to a full-length commit SHA — using a tag will fail the lint. When adding a new step, look up the commit with gh api (the GitHub CLI is the documented tool, though gh is not always available in dev sandboxes — using the GitHub web UI is fine). Verify the SHA isn't an annotated tag object.
VS Code
.vscode/ ships recommended extensions and settings (Python, Pylance, ruff, mypy). The .editorconfig at the repo root sets indentation rules.
Dev container
.devcontainer/ provides a configuration for GitHub Codespaces / VS Code dev containers, pre-installing uv, Python, and the standard toolchain.
Other CLIs
gh— GitHub CLI, used in workflows for label/issue automation.codspeed— performance regression detection incodspeed.yml.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.