Open-Source Wikis

/

LangChain

/

LangChain

/

Getting started

langchain-ai/langchain

Getting started

This page walks through cloning the monorepo, installing dependencies, and running tests, lint, and type checks. The instructions follow the conventions in CLAUDE.md / AGENTS.md at the repository root.

Prerequisites

  • Python 3.10–3.14 — every package's pyproject.toml declares requires-python = ">=3.10.0,<4.0.0".
  • uv — the project uses uv for dependency resolution and editable installs. Install with pipx install uv or curl -LsSf https://astral.sh/uv/install.sh | sh.
  • make — most package directories have a Makefile exposing make test, make lint, make format.
  • git — for cloning and the editable workspace links between packages.

Clone

git clone https://github.com/langchain-ai/langchain.git
cd langchain

Some integration packages live in sibling repositories (for example langchain-google, langchain-aws). If you plan to develop against them, clone them next to langchain/ so the [tool.uv.sources] paths in pyproject.toml (which point one level up, e.g. ../langchain-google/) resolve correctly.

Install a single package

Each package under libs/ is independently versioned and ships its own uv.lock. To work on one package, cd into it and run uv sync:

cd libs/core
uv sync --all-groups       # install every dependency group
uv sync --group test       # or just one group

The most useful groups (defined in each pyproject.toml):

Group Purpose
test Unit tests, no network
test_integration Integration tests that hit real APIs
lint ruff
typing mypy and stub packages
dev Extras like jupyter (only in some packages)

[tool.uv.sources] in each pyproject.toml points at sibling packages with editable = true, so changes in libs/core/ are immediately visible to libs/langchain_v1/ without reinstalling.

Run tests

# From any libs/<package>/ directory
make test                  # unit tests, no network
make test_watch            # runs pytest-watcher
make integration_test      # integration tests (some require API keys)
make benchmark             # the few packages that ship pytest-benchmark

Or invoke pytest directly:

uv run --group test pytest tests/unit_tests/test_specific.py
uv run --group test pytest tests/unit_tests -k "tool_calling"

Lint and format

make lint                  # ruff check + format check + mypy (varies per package)
make format                # ruff format + ruff check --fix

The repo's ruff config selects ALL rules with a small ignore list (see any pyproject.toml's [tool.ruff.lint]). Imports are absolute everywhere — ban-relative-imports = "all" is enabled.

Type-check

uv run --group lint mypy .
# or, when the package's Makefile defines it:
make lint_package          # runs mypy with the package-specific overrides

langchain-core and langchain both use mypy in strict = true mode with enable_error_code = "deprecated". Some test directories opt out (see [tool.mypy.overrides] and [tool.ruff.lint.extend-per-file-ignores]).

Run the whole workspace

There is no top-level Makefile — tests, lint, and builds always run inside a single package directory. The .github/workflows/check_diffs.yml workflow handles which packages to test in CI based on the changed file paths, using _test.yml, _lint.yml, and the other reusable workflows.

To exercise everything locally before opening a PR:

for pkg in libs/core libs/langchain_v1 libs/langchain libs/text-splitters libs/standard-tests libs/model-profiles libs/partners/*/; do
  echo "=== $pkg ==="
  (cd "$pkg" && uv sync --all-groups && make lint && make test)
done

This is what CI effectively does, package by package.

Build a wheel

cd libs/<package>
uv build           # creates dist/*.whl and dist/*.tar.gz via hatchling

hatchling is the build backend for every package in the workspace.

Common tasks

Refresh model capability data

The langchain-profiles CLI in libs/model-profiles/langchain_model_profiles/cli.py pulls model metadata from models.dev and writes it into a partner's data/ directory. See packages/model-profiles and the example invocations in CLAUDE.md.

Add a new partner integration

When adding a new partner under libs/partners/, several auxiliary files need updates — .github/dependabot.yml, .github/scripts/pr-labeler-config.json, .github/workflows/_release.yml, auto-label-by-package.yml, check_diffs.yml, integration_tests.yml, pr_lint.yml. The full list lives in CLAUDE.md under "Adding a new partner to CI".

Documentation

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Getting started – LangChain wiki | Factory