This page covers the physical layout of the monorepo, how each package declares its metadata and dependencies, the build backend used to produce distribution artifacts, and the tooling conventions (uv, dependency groups, local path sources) that tie it together.
For information about the CI/CD pipeline that builds and publishes these packages, see 6.2 For contribution workflows and code standards, see 6.4 For an overview of what each package does at the product level, see 1.1
The repository is organized as a flat collection of independently versioned Python packages under the libs/ directory. Each package directory contains its own pyproject.toml, uv.lock, source tree, and tests.
Monorepo top-level structure
Sources: libs/core/pyproject.toml1-50 libs/langchain_v1/pyproject.toml1-30 libs/langchain/pyproject.toml1-35
Every package in the monorepo uses hatchling as the PEP 517/518 build backend. The build system declaration appears at the top of every pyproject.toml:
This is consistent across libs/core/pyproject.toml, libs/langchain_v1/pyproject.toml, and libs/langchain/pyproject.toml. No setup.py or setup.cfg files are used.
Sources: libs/core/pyproject.toml1-3 libs/langchain_v1/pyproject.toml1-3 libs/langchain/pyproject.toml1-3
Each package declares its metadata under [project] in pyproject.toml. The table below summarizes the key packages.
| Directory | PyPI Name | Current Version | Python Requirement |
|---|---|---|---|
libs/core/ | langchain-core | 1.2.16 | >=3.10.0,<4.0.0 |
libs/langchain_v1/ | langchain | 1.2.10 | >=3.10.0,<4.0.0 |
libs/langchain/ | langchain-classic | 1.0.1 | >=3.10.0,<4.0.0 |
Sources: libs/core/pyproject.toml5-25 libs/langchain_v1/pyproject.toml5-25 libs/langchain/pyproject.toml5-24
Package versions are declared in two places and must stay in sync:
pyproject.toml under [project] versionversion.py or __init__.py inside the package sourceFor langchain-core, the canonical version string lives in libs/core/langchain_core/version.py3 and is imported by libs/core/langchain_core/__init__.py17 to set __version__.
For the langchain package (libs/langchain_v1/), the version string in __init__.py is tested against the pyproject.toml value by libs/langchain_v1/tests/unit_tests/test_version.py10-27
langchain-core intentionally keeps its dependency surface minimal. No third-party model providers or database clients appear here.
libs/langchain_v1/pyproject.toml26-30
libs/langchain/pyproject.toml25-34
Dependency guard test — libs/langchain/tests/unit_tests/test_dependencies.py contains two tests, test_required_dependencies and test_test_group_dependencies, that parse pyproject.toml and assert the exact set of allowed runtime and test dependencies. This prevents accidental introduction of new required dependencies. See libs/langchain/tests/unit_tests/test_dependencies.py23-84
Both the langchain and langchain-classic packages use [project.optional-dependencies] to expose partner integrations as installable extras. These extras pull in specific partner packages but do not require them at runtime by default.
langchain (libs/langchain_v1/) optional-dependencies (libs/langchain_v1/pyproject.toml32-49):
| Extra | Package |
|---|---|
anthropic | langchain-anthropic |
openai | langchain-openai |
mistralai | langchain-mistralai |
groq | langchain-groq |
fireworks | langchain-fireworks |
ollama | langchain-ollama |
huggingface | langchain-huggingface |
deepseek | langchain-deepseek |
xai | langchain-xai |
perplexity | langchain-perplexity |
community | langchain-community |
google-vertexai | langchain-google-vertexai |
google-genai | langchain-google-genai |
aws | langchain-aws |
The langchain-classic package declares the same set (minus community and azure-ai) at libs/langchain/pyproject.toml36-53
PEP 735 dependency groups (the [dependency-groups] table) separate development-time dependencies from runtime ones. These are not installed when a user installs the package from PyPI; they exist only in the local development environment.
Standard dependency groups across packages
| Group | Purpose |
|---|---|
test | pytest and supporting test libraries (no integration targets) |
test_integration | additional packages needed for integration tests |
lint | ruff for linting |
typing | mypy and type stubs |
dev | notebooks, development utilities |
langchain-core dependency groups (libs/core/pyproject.toml47-78):
The test_integration group in langchain-core is intentionally left empty — integration tests for the core library are run through partner package test suites.
Sources: libs/core/pyproject.toml47-78 libs/langchain/pyproject.toml65-120 libs/langchain_v1/pyproject.toml61-91
Within the monorepo, packages that depend on sibling packages declare them as local editable installs using [tool.uv.sources]. This means during development, changes to langchain-core are immediately reflected in packages that depend on it without re-installing.
langchain-core (libs/core/pyproject.toml80-82):
langchain-classic (libs/langchain/pyproject.toml130-134):
langchain (libs/langchain_v1/) (libs/langchain_v1/pyproject.toml97-102):
uv.lock files — Each package directory contains a uv.lock file that pins the full resolved dependency graph. These files are checked into source control and updated by running uv lock. The lock files cover all dependency groups and record exact versions and hashes for reproducible installs.
Sources: libs/core/pyproject.toml80-82 libs/langchain/pyproject.toml130-134 libs/langchain_v1/pyproject.toml97-102 libs/core/uv.lock1-14
Annotated structure of a representative pyproject.toml
Sources: libs/core/pyproject.toml1-149 libs/langchain_v1/pyproject.toml1-198
Each package uses ruff for linting and formatting, and mypy for static type analysis.
All packages select "ALL" rules and then ignore specific categories. Common ignores across packages:
| Rule | Reason |
|---|---|
C90 | McCabe complexity |
COM812 | Conflicts with ruff formatter |
FIX002 | TODO line suppression |
PLR09 | Too-many-X checks |
TD002, TD003 | Missing TODO author / issue link |
ANN401 | Allows Any type annotations |
The convention is google docstring style (libs/core/pyproject.toml127-129), and relative imports are banned via ban-relative-imports = "all" (libs/core/pyproject.toml124-125).
All packages set strict = true and use the pydantic.mypy plugin. disallow_any_generics is disabled as a noted TODO (libs/core/pyproject.toml91). The deprecated error code is enabled to catch usage of deprecated symbols.
Sources: libs/core/pyproject.toml85-136 libs/langchain_v1/pyproject.toml104-116 libs/langchain/pyproject.toml139-206
Pytest is configured through [tool.pytest.ini_options] in each package's pyproject.toml. The configuration is largely consistent across packages.
| Setting | Value |
|---|---|
addopts | --strict-markers --strict-config --durations=5 |
asyncio_mode | auto (all async tests run automatically) |
markers | requires, compile, scheduled |
filterwarnings | Suppresses LangChainBetaWarning and LangChainDeprecationWarning in tests |
The requires marker is implemented in conftest.py files. The conftest.py in libs/langchain/ also adds --only-extended, --only-core, and --community command-line options for controlling which tests run. See libs/langchain/tests/unit_tests/conftest.py9-28
Sources: libs/core/pyproject.toml141-149 libs/langchain_v1/pyproject.toml185-198 libs/langchain/pyproject.toml225-237
Runtime dependency resolution between packages
Sources: libs/core/pyproject.toml60-82 libs/langchain_v1/pyproject.toml26-102 libs/langchain/pyproject.toml25-134
Some packages declare constraint dependencies via [tool.uv] constraint-dependencies to enforce minimum versions of transitive dependencies without adding them as direct runtime requirements. For example, langchain-classic and langchain both constrain:
libs/langchain/pyproject.toml136-137 libs/langchain_v1/pyproject.toml93-95
The langchain package also sets prerelease = "allow" to allow testing against pre-release versions of dependencies when needed.
| Concern | Mechanism | Configuration Key |
|---|---|---|
| Build backend | hatchling | [build-system] |
| Dependency locking | uv lock | uv.lock per package |
| Local sibling packages | editable path sources | [tool.uv.sources] |
| Dev/test deps | PEP 735 groups | [dependency-groups] |
| Provider extras | optional-dependencies | [project.optional-dependencies] |
| Linting | ruff | [tool.ruff.lint] |
| Type checking | mypy (strict) | [tool.mypy] |
| Test runner | pytest | [tool.pytest.ini_options] |
| Version tracking | pyproject.toml + version.py | [project] version + VERSION |
Refresh this wiki
This wiki was recently refreshed. Please wait 2 days to refresh again.