Skip to content

The agent engineering platform.

chore(infra): audit workflows, scripts (#33055)

Mason Daugherty2c95586f2a88
diff --git a/.github/actions/people/action.yml b/.github/actions/people/action.yml
index a517c496a1..718a244dab 100644
--- a/.github/actions/people/action.yml
+++ b/.github/actions/people/action.yml
@@ -1,4 +1,6 @@
# Adapted from https://github.com/tiangolo/fastapi/blob/master/.github/actions/people/action.yml
+# TODO: fix this, migrate to new docs repo?
+
name: "Generate LangChain People"
description: "Generate the data for the LangChain People page"
author: "Jacob Lee <[email protected]>"
diff --git a/.github/actions/uv_setup/action.yml b/.github/actions/uv_setup/action.yml
index bf4a8689cd..1d701d7428 100644
--- a/.github/actions/uv_setup/action.yml
+++ b/.github/actions/uv_setup/action.yml
@@ -1,3 +1,5 @@
+# Helper to set up Python and uv with caching
+
name: uv-install
description: Set up Python and uv with caching
@@ -8,15 +10,15 @@ inputs:
enable-cache:
description: Enable caching for uv dependencies
required: false
- default: 'true'
+ default: "true"
cache-suffix:
description: Custom cache key suffix for cache invalidation
required: false
- default: ''
+ default: ""
working-directory:
description: Working directory for cache glob scoping
required: false
- default: '**'
+ default: "**"
env:
UV_VERSION: "0.5.25"
diff --git a/.github/labeler.yml b/.github/pr-file-labeler.yml
similarity index 97%
rename from .github/labeler.yml
rename to .github/pr-file-labeler.yml
index 7ffab69b36..46d27024d7 100644
--- a/.github/labeler.yml
+++ b/.github/pr-file-labeler.yml
@@ -1,4 +1,4 @@
-# GitHub PR Labeler Configuration for LangChain
+# Label PRs (config)
# Automatically applies labels based on changed files and branch patterns
# Core packages
diff --git a/.github/pr-title-labeler.yml b/.github/pr-title-labeler.yml
index 0b78e4113a..273456cb64 100644
--- a/.github/pr-title-labeler.yml
+++ b/.github/pr-title-labeler.yml
@@ -1,5 +1,7 @@
-# PR Title Labeler Configuration
+# PR title labeler config
+#
# Labels PRs based on conventional commit patterns in titles
+#
# Format: type(scope): description or type!: description (breaking)
add-missing-labels: true
diff --git a/.github/scripts/check_diff.py b/.github/scripts/check_diff.py
index 4cf7e6415e..8ce0b9b228 100644
--- a/.github/scripts/check_diff.py
+++ b/.github/scripts/check_diff.py
@@ -1,3 +1,18 @@
+"""Analyze git diffs to determine which directories need to be tested.
+
+Intelligently determines which LangChain packages and directories need to be tested,
+linted, or built based on the changes. Handles dependency relationships between
+packages, maps file changes to appropriate CI job configurations, and outputs JSON
+configurations for GitHub Actions.
+
+- Maps changed files to affected package directories (libs/core, libs/partners/*, etc.)
+- Builds dependency graph to include dependent packages when core components change
+- Generates test matrix configurations with appropriate Python versions
+- Handles special cases for Pydantic version testing and performance benchmarks
+
+Used as part of the check_diffs workflow.
+"""
+
import glob
import json
import os
@@ -17,7 +32,7 @@ LANGCHAIN_DIRS = [
"libs/langchain_v1",
]
-# when set to True, we are ignoring core dependents
+# When set to True, we are ignoring core dependents
# in order to be able to get CI to pass for each individual
# package that depends on core
# e.g. if you touch core, we don't then add textsplitters/etc to CI
@@ -49,9 +64,9 @@ def all_package_dirs() -> Set[str]:
def dependents_graph() -> dict:
- """
- Construct a mapping of package -> dependents, such that we can
- run tests on all dependents of a package when a change is made.
+ """Construct a mapping of package -> dependents
+
+ Done such that we can run tests on all dependents of a package when a change is made.
"""
dependents = defaultdict(set)
@@ -123,9 +138,6 @@ def _get_configs_for_single_dir(job: str, dir_: str) -> List[Dict[str, str]]:
elif dir_ == "libs/core":
py_versions = ["3.9", "3.10", "3.11", "3.12", "3.13"]
# custom logic for specific directories
- elif dir_ == "libs/partners/milvus":
- # milvus doesn't allow 3.12 because they declare deps in funny way
- py_versions = ["3.9", "3.11"]
elif dir_ in PY_312_MAX_PACKAGES:
py_versions = ["3.9", "3.12"]
diff --git a/.github/scripts/check_prerelease_dependencies.py b/.github/scripts/check_prerelease_dependencies.py
index 20fcad5a97..f445ede08f 100644
--- a/.github/scripts/check_prerelease_dependencies.py
+++ b/.github/scripts/check_prerelease_dependencies.py
@@ -1,3 +1,5 @@
+"""Check that no dependencies allow prereleases unless we're releasing a prerelease."""
+
import sys
import tomllib
@@ -6,15 +8,14 @@ if __name__ == "__main__":
# Get the TOML file path from the command line argument
toml_file = sys.argv[1]
- # read toml file
with open(toml_file, "rb") as file:
toml_data = tomllib.load(file)
- # see if we're releasing an rc
+ # See if we're releasing an rc or dev version
version = toml_data["project"]["version"]
releasing_rc = "rc" in version or "dev" in version
- # if not, iterate through dependencies and make sure none allow prereleases
+ # If not, iterate through dependencies and make sure none allow prereleases
if not releasing_rc:
dependencies = toml_data["project"]["dependencies"]
for dep_version in dependencies:
diff --git a/.github/scripts/get_min_versions.py b/.github/scripts/get_min_versions.py
index 91212625b8..c5c5ecc570 100644
--- a/.github/scripts/get_min_versions.py
+++ b/.github/scripts/get_min_versions.py
@@ -1,3 +1,5 @@
+"""Get minimum versions of dependencies from a pyproject.toml file."""
+
import sys
from collections import defaultdict
from typing import Optional
@@ -5,7 +7,7 @@ from typing import Optional
if sys.version_info >= (3, 11):
import tomllib
else:
- # for python 3.10 and below, which doesnt have stdlib tomllib
+ # For Python 3.10 and below, which doesnt have stdlib tomllib
import tomli as tomllib
import re
@@ -34,14 +36,13 @@ SKIP_IF_PULL_REQUEST = [
def get_pypi_versions(package_name: str) -> List[str]:
- """
- Fetch all available versions for a package from PyPI.
+ """Fetch all available versions for a package from PyPI.
Args:
- package_name (str): Name of the package
+ package_name: Name of the package
Returns:
- List[str]: List of all available versions
+ List of all available versions
Raises:
requests.exceptions.RequestException: If PyPI API request fails
@@ -54,24 +55,23 @@ def get_pypi_versions(package_name: str) -> List[str]:
def get_minimum_version(package_name: str, spec_string: str) -> Optional[str]:
- """
- Find the minimum published version that satisfies the given constraints.
+ """Find the minimum published version that satisfies the given constraints.
Args:
- package_name (str): Name of the package
- spec_string (str): Version specification string (e.g., ">=0.2.43,<0.4.0,!=0.3.0")
+ package_name: Name of the package
+ spec_string: Version specification string (e.g., ">=0.2.43,<0.4.0,!=0.3.0")
Returns:
- Optional[str]: Minimum compatible version or None if no compatible version found
+ Minimum compatible version or None if no compatible version found
"""
- # rewrite occurrences of ^0.0.z to 0.0.z (can be anywhere in constraint string)
+ # Rewrite occurrences of ^0.0.z to 0.0.z (can be anywhere in constraint string)
spec_string = re.sub(r"\^0\.0\.(\d+)", r"0.0.\1", spec_string)
- # rewrite occurrences of ^0.y.z to >=0.y.z,<0.y+1 (can be anywhere in constraint string)
+ # Rewrite occurrences of ^0.y.z to >=0.y.z,<0.y+1 (can be anywhere in constraint string)
for y in range(1, 10):
spec_string = re.sub(
rf"\^0\.{y}\.(\d+)", rf">=0.{y}.\1,<0.{y + 1}", spec_string
)
- # rewrite occurrences of ^x.y.z to >=x.y.z,<x+1.0.0 (can be anywhere in constraint string)
+ # Rewrite occurrences of ^x.y.z to >=x.y.z,<x+1.0.0 (can be anywhere in constraint string)
for x in range(1, 10):
spec_string = re.sub(
rf"\^{x}\.(\d+)\.(\d+)", rf">={x}.\1.\2,<{x + 1}", spec_string
@@ -154,22 +154,25 @@ def get_min_version_from_toml(
def check_python_version(version_string, constraint_string):
- """
- Check if the given Python version matches the given constraints.
+ """Check if the given Python version matches the given constraints.
- :param version_string: A string representing the Python version (e.g. "3.8.5").
- :param constraint_string: A string representing the package's Python version constraints (e.g. ">=3.6, <4.0").
- :return: True if the version matches the constraints, False otherwise.
+ Args:
+ version_string: A string representing the Python version (e.g. "3.8.5").
+ constraint_string: A string representing the package's Python version
+ constraints (e.g. ">=3.6, <4.0").
+
+ Returns:
+ True if the version matches the constraints
"""
- # rewrite occurrences of ^0.0.z to 0.0.z (can be anywhere in constraint string)
+ # Rewrite occurrences of ^0.0.z to 0.0.z (can be anywhere in constraint string)
constraint_string = re.sub(r"\^0\.0\.(\d+)", r"0.0.\1", constraint_string)
- # rewrite occurrences of ^0.y.z to >=0.y.z,<0.y+1.0 (can be anywhere in constraint string)
+ # Rewrite occurrences of ^0.y.z to >=0.y.z,<0.y+1.0 (can be anywhere in constraint string)
for y in range(1, 10):
constraint_string = re.sub(
rf"\^0\.{y}\.(\d+)", rf">=0.{y}.\1,<0.{y + 1}.0", constraint_string
)
- # rewrite occurrences of ^x.y.z to >=x.y.z,<x+1.0.0 (can be anywhere in constraint string)
+ # Rewrite occurrences of ^x.y.z to >=x.y.z,<x+1.0.0 (can be anywhere in constraint string)
for x in range(1, 10):
constraint_string = re.sub(
rf"\^{x}\.0\.(\d+)", rf">={x}.0.\1,<{x + 1}.0.0", constraint_string
diff --git a/.github/scripts/prep_api_docs_build.py b/.github/scripts/prep_api_docs_build.py
index 4dad98f53c..460a24d1fc 100644
--- a/.github/scripts/prep_api_docs_build.py
+++ b/.github/scripts/prep_api_docs_build.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-"""Script to sync libraries from various repositories into the main langchain repository."""
+"""Sync libraries from various repositories into this monorepo."""
import os
import shutil
diff --git a/.github/workflows/_compile_integration_test.yml b/.github/workflows/_compile_integration_test.yml
index 4e4a1ac3ba..dc49c03da7 100644
--- a/.github/workflows/_compile_integration_test.yml
+++ b/.github/workflows/_compile_integration_test.yml
@@ -1,3 +1,11 @@
+# Validates that a package's integration tests compile without syntax or import errors.
+#
+# (If an integration test fails to compile, it won't run.)
+#
+# Called as part of check_diffs.yml workflow
+#
+# Runs pytest with compile marker to check syntax/imports.
+
name: 'πŸ”— Compile Integration Tests'
on:
diff --git a/.github/workflows/_integration_test.yml b/.github/workflows/_integration_test.yml
index 0579c2e730..6af79b9421 100644
--- a/.github/workflows/_integration_test.yml
+++ b/.github/workflows/_integration_test.yml
@@ -1,3 +1,10 @@
+
+# Runs `make integration_tests` on the specified package.
+#
+# Manually triggered via workflow_dispatch for testing with real APIs.
+#
+# Installs integration test dependencies and executes full test suite.
+
name: 'πŸš€ Integration Tests'
run-name: 'Test ${{ inputs.working-directory }} on Python ${{ inputs.python-version }}'
@@ -83,7 +90,7 @@ jobs:
run: |
make integration_tests
- - name: Ensure the tests did not create any additional files
+ - name: 'Ensure testing did not create/modify files'
shell: bash
run: |
set -eu
diff --git a/.github/workflows/_lint.yml b/.github/workflows/_lint.yml
index 817e15de85..04af83f802 100644
--- a/.github/workflows/_lint.yml
+++ b/.github/workflows/_lint.yml
@@ -1,6 +1,11 @@
-name: '🧹 Code Linting'
-# Runs code quality checks using ruff, mypy, and other linting tools
-# Checks both package code and test code for consistency
+# Runs linting.
+#
+# Uses the package's Makefile to run the checks, specifically the
+# `lint_package` and `lint_tests` targets.
+#
+# Called as part of check_diffs.yml workflow.
+
+name: '🧹 Linting'
on:
workflow_call:
@@ -43,14 +48,6 @@ jobs:
working-directory: ${{ inputs.working-directory }}
- name: 'πŸ“¦ Install Lint & Typing Dependencies'
- # Also installs dev/lint/test/typing dependencies, to ensure we have
- # type hints for as many of our libraries as possible.
- # This helps catch errors that require dependencies to be spotted, for example:
- # https://github.com/langchain-ai/langchain/pull/10249/files#diff-935185cd488d015f026dcd9e19616ff62863e8cde8c0bee70318d3ccbca98341
- #
- # If you change this configuration, make sure to change the `cache-key`
- # in the `poetry_setup` action above to stop using the old cache.
- # It doesn't matter how you change it, any change will cause a cache-bust.
working-directory: ${{ inputs.working-directory }}
run: |
uv sync --group lint --group typing
@@ -60,20 +57,13 @@ jobs:
run: |
make lint_package
- - name: 'πŸ“¦ Install Unit Test Dependencies'
- # Also installs dev/lint/test/typing dependencies, to ensure we have
- # type hints for as many of our libraries as possible.
- # This helps catch errors that require dependencies to be spotted, for example:
- # https://github.com/langchain-ai/langchain/pull/10249/files#diff-935185cd488d015f026dcd9e19616ff62863e8cde8c0bee70318d3ccbca98341
- #
- # If you change this configuration, make sure to change the `cache-key`
- # in the `poetry_setup` action above to stop using the old cache.
- # It doesn't matter how you change it, any change will cause a cache-bust.
+ - name: 'πŸ“¦ Install Test Dependencies (non-partners)'
+ # (For directories NOT starting with libs/partners/)
if: ${{ ! startsWith(inputs.working-directory, 'libs/partners/') }}
working-directory: ${{ inputs.working-directory }}
run: |
uv sync --inexact --group test
- - name: 'πŸ“¦ Install Unit + Integration Test Dependencies'
+ - name: 'πŸ“¦ Install Test Dependencies'
if: ${{ startsWith(inputs.working-directory, 'libs/partners/') }}
working-directory: ${{ inputs.working-directory }}
run: |
diff --git a/.github/workflows/_release.yml b/.github/workflows/_release.yml
index 8b1e272bdc..6d08c5c344 100644
--- a/.github/workflows/_release.yml
+++ b/.github/workflows/_release.yml
@@ -1,3 +1,9 @@
+# Builds and publishes LangChain packages to PyPI.
+#
+# Manually triggered, though can be used as a reusable workflow (workflow_call).
+#
+# Handles version bumping, building, and publishing to PyPI with authentication.
+
name: 'πŸš€ Package Release'
run-name: 'Release ${{ inputs.working-directory }} ${{ inputs.release-version }}'
on:
@@ -52,8 +58,8 @@ jobs:
# We want to keep this build stage *separate* from the release stage,
# so that there's no sharing of permissions between them.
- # The release stage has trusted publishing and GitHub repo contents write access,
- # and we want to keep the scope of that access limited just to the release job.
+ # (Release stage has trusted publishing and GitHub repo contents write access,
+ #
# Otherwise, a malicious `build` step (e.g. via a compromised dependency)
# could get access to our GitHub or PyPI credentials.
#
@@ -288,16 +294,19 @@ jobs:
run: |
VIRTUAL_ENV=.venv uv pip install dist/*.whl
- - name: Run unit tests
- run: make tests
- working-directory: ${{ inputs.working-directory }}
-
- name: Check for prerelease versions
+ # Block release if any dependencies allow prerelease versions
+ # (unless this is itself a prerelease version)
working-directory: ${{ inputs.working-directory }}
run: |
uv run python $GITHUB_WORKSPACE/.github/scripts/check_prerelease_dependencies.py pyproject.toml
+ - name: Run unit tests
+ run: make tests
+ working-directory: ${{ inputs.working-directory }}
+
- name: Get minimum versions
+ # Find the minimum published versions that satisfies the given constraints
working-directory: ${{ inputs.working-directory }}
id: min-version
run: |
@@ -322,6 +331,7 @@ jobs:
working-directory: ${{ inputs.working-directory }}
- name: Run integration tests
+ # Uses the Makefile's `integration_tests` target for the specified package
if: ${{ startsWith(inputs.working-directory, 'libs/partners/') }}
env:
AI21_API_KEY: ${{ secrets.AI21_API_KEY }}
@@ -362,7 +372,10 @@ jobs:
working-directory: ${{ inputs.working-directory }}
# Test select published packages against new core
+ # Done when code changes are made to langchain-core
test-prior-published-packages-against-new-core:
+ # Installs the new core with old partners: Installs the new unreleased core
+ # alongside the previously published partner packages and runs integration tests
needs:
- build
- release-notes
@@ -390,6 +403,7 @@ jobs:
# We implement this conditional as Github Actions does not have good support
# for conditionally needing steps. https://github.com/actions/runner/issues/491
+ # TODO: this seems to be resolved upstream, so we can probably remove this workaround
- name: Check if libs/core
run: |
if [ "${{ startsWith(inputs.working-directory, 'libs/core') }}" != "true" ]; then
@@ -444,6 +458,7 @@ jobs:
make integration_tests
publish:
+ # Publishes the package to PyPI
needs:
- build
- release-notes
@@ -486,6 +501,7 @@ jobs:
attestations: false
mark-release:
+ # Marks the GitHub release with the new version tag
needs:
- build
- release-notes
@@ -495,7 +511,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
# This permission is needed by `ncipollo/release-action` to
- # create the GitHub release.
+ # create the GitHub release/tag
contents: write
defaults:
diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml
index b49cb5440b..488b0d65b2 100644
--- a/.github/workflows/_test.yml
+++ b/.github/workflows/_test.yml
@@ -1,6 +1,7 @@
-name: 'πŸ§ͺ Unit Testing'
# Runs unit tests with both current and minimum supported dependency versions
-# to ensure compatibility across the supported range
+# to ensure compatibility across the supported range.
+
+name: 'πŸ§ͺ Unit Testing'
on:
workflow_call:
diff --git a/.github/workflows/_test_doc_imports.yml b/.github/workflows/_test_doc_imports.yml
index 5347c4d7c4..dc2c55fbd7 100644
--- a/.github/workflows/_test_doc_imports.yml
+++ b/.github/workflows/_test_doc_imports.yml
@@ -1,3 +1,10 @@
+# Validates that all import statements in `.ipynb` notebooks are correct and functional.
+#
+# Called as part of check_diffs.yml.
+#
+# Installs test dependencies and LangChain packages in editable mode and
+# runs check_imports.py.
+
name: 'πŸ“‘ Documentation Import Testing'
on:
diff --git a/.github/workflows/_test_pydantic.yml b/.github/workflows/_test_pydantic.yml
index 89e4f0dae1..7363231fd6 100644
--- a/.github/workflows/_test_pydantic.yml
+++ b/.github/workflows/_test_pydantic.yml
@@ -1,3 +1,5 @@
+# Facilitate unit testing against different Pydantic versions for a provided package.
+
name: '🐍 Pydantic Version Testing'
on:
diff --git a/.github/workflows/api_doc_build.yml b/.github/workflows/api_doc_build.yml
index 0702dc57c6..f7c2c62792 100644
--- a/.github/workflows/api_doc_build.yml
+++ b/.github/workflows/api_doc_build.yml
@@ -1,11 +1,14 @@
+# Build the API reference documentation.
+#
+# Runs daily. Can also be triggered manually for immediate updates.
+
name: 'πŸ“š API Docs'
run-name: 'Build & Deploy API Reference'
-# Runs daily or can be triggered manually for immediate updates
on:
workflow_dispatch:
schedule:
- - cron: '0 13 * * *' # Daily at 1PM UTC
+ - cron: '0 13 * * *' # Runs daily at 1PM UTC (9AM EDT/6AM PDT)
env:
PYTHON_VERSION: "3.11"
diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml
index 6c949b5bbf..4f1f0a1ce2 100644
--- a/.github/workflows/check-broken-links.yml
+++ b/.github/workflows/check-broken-links.yml
@@ -1,9 +1,11 @@
+# Runs broken link checker in /docs on a daily schedule.
+
name: 'πŸ”— Check Broken Links'
on:
workflow_dispatch:
schedule:
- - cron: '0 13 * * *'
+ - cron: '0 13 * * *' # Runs daily at 1PM UTC (9AM EDT/6AM PDT)
permissions:
contents: read
diff --git a/.github/workflows/check_core_versions.yml b/.github/workflows/check_core_versions.yml
index 7905bf06ce..0c0122d435 100644
--- a/.github/workflows/check_core_versions.yml
+++ b/.github/workflows/check_core_versions.yml
@@ -1,6 +1,8 @@
+# Ensures version numbers in pyproject.toml and version.py stay in sync.
+#
+# (Prevents releases with mismatched version numbers)
+
name: 'πŸ” Check `core` Version Equality'
-# Ensures version numbers in pyproject.toml and version.py stay in sync
-# Prevents releases with mismatched version numbers
on:
pull_request:
diff --git a/.github/workflows/check_diffs.yml b/.github/workflows/check_diffs.yml
index 37eabe5583..0fb1994318 100644
--- a/.github/workflows/check_diffs.yml
+++ b/.github/workflows/check_diffs.yml
@@ -1,3 +1,18 @@
+# Primary CI workflow.
+#
+# Only runs against packages that have changed files.
+#
+# Runs:
+# - Linting (_lint.yml)
+# - Unit Tests (_test.yml)
+# - Pydantic compatibility tests (_test_pydantic.yml)
+# - Documentation import tests (_test_doc_imports.yml)
+# - Integration test compilation checks (_compile_integration_test.yml)
+# - Extended test suites that require additional dependencies
+# - Codspeed benchmarks (if not labeled 'codspeed-ignore')
+#
+# Reports status to GitHub checks and PR status.
+
name: 'πŸ”§ CI'
on:
@@ -11,8 +26,8 @@ on:
# cancel the earlier run in favor of the next run.
#
# There's no point in testing an outdated version of the code. GitHub only allows
-# a limited number of job runners to be active at the same time, so it's better to cancel
-# pointless jobs early so that more useful jobs can run sooner.
+# a limited number of job runners to be active at the same time, so it's better to
+# cancel pointless jobs early so that more useful jobs can run sooner.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
diff --git a/.github/workflows/check_new_docs.yml b/.github/workflows/check_new_docs.yml
index cf988ba115..f026a765b0 100644
--- a/.github/workflows/check_new_docs.yml
+++ b/.github/workflows/check_new_docs.yml
@@ -1,3 +1,6 @@
+# For integrations, we run check_templates.py to ensure that new docs use the correct
+# templates based on their type. See the script for more details.
+
name: 'πŸ“‘ Integration Docs Lint'
on:
diff --git a/.github/workflows/people.yml b/.github/workflows/people.yml
index 3347d61ff5..0d4b1b8090 100644
--- a/.github/workflows/people.yml
+++ b/.github/workflows/people.yml
@@ -1,9 +1,11 @@
+# Updates the LangChain People data by fetching the latest info from the LangChain Git.
+# TODO: broken/not used
+
name: 'πŸ‘₯ LangChain People'
run-name: 'Update People Data'
-# This workflow updates the LangChain People data by fetching the latest information from the LangChain Git
on:
schedule:
- - cron: "0 14 1 * *"
+ - cron: "0 14 1 * *" # Runs at 14:00 UTC on the 1st of every month (10AM EDT/7AM PDT)
push:
branches: [jacob/people]
workflow_dispatch:
diff --git a/.github/workflows/labeler.yml b/.github/workflows/pr_labeler_file.yml
similarity index 71%
rename from .github/workflows/labeler.yml
rename to .github/workflows/pr_labeler_file.yml
index 6e4d60a037..503f657750 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/pr_labeler_file.yml
@@ -1,3 +1,7 @@
+# Label PRs based on changed files.
+#
+# See `.github/pr-file-labeler.yml` to see rules for each label/directory.
+
name: "🏷️ Pull Request Labeler"
on:
@@ -18,5 +22,5 @@ jobs:
uses: actions/labeler@v6
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- configuration-path: .github/labeler.yml
+ configuration-path: .github/pr-file-labeler.yml
sync-labels: false
diff --git a/.github/workflows/pr_title_labeler.yml b/.github/workflows/pr_labeler_title.yml
similarity index 79%
rename from .github/workflows/pr_title_labeler.yml
rename to .github/workflows/pr_labeler_title.yml
index d5aa8e6c7b..43f0547cbe 100644
--- a/.github/workflows/pr_title_labeler.yml
+++ b/.github/workflows/pr_labeler_title.yml
@@ -1,3 +1,7 @@
+# Label PRs based on their titles.
+#
+# See `.github/pr-title-labeler.yml` to see rules for each label/title pattern.
+
name: "🏷️ PR Title Labeler"
on:
diff --git a/.github/workflows/pr_lint.yml b/.github/workflows/pr_lint.yml
index 1adca68042..56634082a5 100644
--- a/.github/workflows/pr_lint.yml
+++ b/.github/workflows/pr_lint.yml
@@ -1,29 +1,30 @@
-# -----------------------------------------------------------------------------
-# PR Title Lint Workflow
+# PR title linting.
#
-# Purpose:
-# Enforces Conventional Commits format for pull request titles to maintain a
-# clear, consistent, and machine-readable change history across our repository.
-# This helps with automated changelog generation and semantic versioning.
+# FORMAT (Conventional Commits 1.0.0):
#
-# Enforced Commit Message Format (Conventional Commits 1.0.0):
# <type>[optional scope]: <description>
# [optional body]
# [optional footer(s)]
#
+# Examples:
+# feat(core): add multi‐tenant support
+# fix(cli): resolve flag parsing error
+# docs: update API usage examples
+# docs(openai): update API usage examples
+#
# Allowed Types:
-# β€’ feat β€” a new feature (MINOR bump)
-# β€’ fix β€” a bug fix (PATCH bump)
-# β€’ docs β€” documentation only changes
-# β€’ style β€” formatting, missing semi-colons, etc.; no code change
-# β€’ refactor β€” code change that neither fixes a bug nor adds a feature
-# β€’ perf β€” code change that improves performance
-# β€’ test β€” adding missing tests or correcting existing tests
-# β€’ build β€” changes that affect the build system or external dependencies
-# β€’ ci β€” continuous integration/configuration changes
-# β€’ chore β€” other changes that don't modify src or test files
-# β€’ revert β€” reverts a previous commit
-# β€’ release β€” prepare a new release
+# * feat β€” a new feature (MINOR)
+# * fix β€” a bug fix (PATCH)
+# * docs β€” documentation only changes (either in /docs or code comments)
+# * style β€” formatting, linting, etc.; no code change or typing refactors
+# * refactor β€” code change that neither fixes a bug nor adds a feature
+# * perf β€” code change that improves performance
+# * test β€” adding tests or correcting existing
+# * build β€” changes that affect the build system/external dependencies
+# * ci β€” continuous integration/configuration changes
+# * chore β€” other changes that don't modify source or test files
+# * revert β€” reverts a previous commit
+# * release β€” prepare a new release
#
# Allowed Scopes (optional):
# core, cli, langchain, langchain_v1, langchain_legacy, standard-tests,
@@ -31,21 +32,12 @@
# huggingface, mistralai, nomic, ollama, openai, perplexity, prompty, qdrant,
# xai, infra
#
-# Rules & Tips for New Committers:
-# 1. Subject (type) must start with a lowercase letter and, if possible, be
-# followed by a scope wrapped in parenthesis `(scope)`
-# 2. Breaking changes:
-# – Append "!" after type/scope (e.g., feat!: drop Node 12 support)
-# – Or include a footer "BREAKING CHANGE: <details>"
-# 3. Example PR titles:
-# feat(core): add multi‐tenant support
-# fix(cli): resolve flag parsing error
-# docs: update API usage examples
-# docs(openai): update API usage examples
+# Rules:
+# 1. The 'Type' must start with a lowercase letter.
+# 2. Breaking changes: append "!" after type/scope (e.g., feat!: drop x support)
#
-# Resources:
-# β€’ Conventional Commits spec: https://www.conventionalcommits.org/en/v1.0.0/
-# -----------------------------------------------------------------------------
+# Enforces Conventional Commits format for pull request titles to maintain a clear and
+# machine-readable change history.
name: '🏷️ PR Title Lint'
@@ -57,7 +49,7 @@ on:
types: [opened, edited, synchronize]
jobs:
- # Validates that PR title follows Conventional Commits specification
+ # Validates that PR title follows Conventional Commits 1.0.0 specification
lint-pr-title:
name: 'validate format'
runs-on: ubuntu-latest
diff --git a/.github/workflows/run_notebooks.yml b/.github/workflows/run_notebooks.yml
index 5649d37e6f..3f3971658d 100644
--- a/.github/workflows/run_notebooks.yml
+++ b/.github/workflows/run_notebooks.yml
@@ -1,3 +1,5 @@
+# Integration tests for documentation notebooks.
+
name: 'πŸ““ Validate Documentation Notebooks'
run-name: 'Test notebooks in ${{ inputs.working-directory }}'
on:
diff --git a/.github/workflows/scheduled_test.yml b/.github/workflows/scheduled_test.yml
index f5266b5d87..e44ecac6d3 100644
--- a/.github/workflows/scheduled_test.yml
+++ b/.github/workflows/scheduled_test.yml
@@ -1,8 +1,14 @@
+# Routine integration tests against partner libraries with live API credentials.
+#
+# Uses `make integration_tests` for each library in the matrix.
+#
+# Runs daily. Can also be triggered manually for immediate updates.
+
name: '⏰ Scheduled Integration Tests'
run-name: "Run Integration Tests - ${{ inputs.working-directory-force || 'all libs' }} (Python ${{ inputs.python-version-force || '3.9, 3.11' }})"
on:
- workflow_dispatch: # Allows maintainers to trigger the workflow manually in GitHub UI
+ workflow_dispatch:
inputs:
working-directory-force:
type: string
@@ -54,13 +60,13 @@ jobs:
echo $matrix
echo "matrix=$matrix" >> $GITHUB_OUTPUT
# Run integration tests against partner libraries with live API credentials
- # Tests are run with both Poetry and UV depending on the library's setup
+ # Tests are run with Poetry or UV depending on the library's setup
build:
if: github.repository_owner == 'langchain-ai' || github.event_name != 'schedule'
name: '🐍 Python ${{ matrix.python-version }}: ${{ matrix.working-directory }}'
runs-on: ubuntu-latest
needs: [compute-matrix]
- timeout-minutes: 20
+ timeout-minutes: 30
strategy:
fail-fast: false
matrix:
@@ -161,7 +167,7 @@ jobs:
make integration_tests
- name: '🧹 Clean up External Libraries'
- # Clean up external libraries to avoid affecting git status check
+ # Clean up external libraries to avoid affecting the following git status check
run: |
rm -rf \
langchain/libs/partners/google-genai \
diff --git a/.github/workflows/v1_changes.md b/.github/workflows/v1_changes.md
new file mode 100644
index 0000000000..a64244f821
--- /dev/null
+++ b/.github/workflows/v1_changes.md
@@ -0,0 +1,9 @@
+With the deprecation of v0 docs, the following files will need to be migrated/supported
+in the new docs repo:
+
+- run_notebooks.yml: New repo should run Integration tests on code snippets?
+- people.yml: Need to fix and somehow display on the new docs site
+ - Subsequently, `.github/actions/people/`
+- _test_doc_imports.yml
+- check_new_docs.yml
+- check-broken-links.yml
diff --git a/docs/scripts/check_imports.py b/docs/scripts/check_imports.py
index 461d2bb858..aabe1a1f0a 100644
--- a/docs/scripts/check_imports.py
+++ b/docs/scripts/check_imports.py
@@ -1,4 +1,20 @@
-"""This script checks documentation for broken import statements."""
+"""Check documentation for broken import statements.
+
+Validates that all import statements in Jupyter notebooks within the documentation
+directory are functional and can be successfully imported.
+
+- Scans all `.ipynb` files in `docs/`
+- Extracts import statements from code cells
+- Tests each import to ensure it works
+- Reports any broken imports that would fail for users
+
+Usage:
+ python docs/scripts/check_imports.py
+
+Exit codes:
+ 0: All imports are valid
+ 1: Found broken imports (ImportError raised)
+"""
import importlib
import json