diff --git a/Makefile b/Makefile index 4bcad7bd107..a3ce56bbea3 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ docs_linkcheck: ## api_docs_build: Build the API Reference documentation. api_docs_build: clean @echo "📖 Building API Reference documentation..." + uv pip install -e libs/cli uv run --group docs python docs/api_reference/create_api_rst.py cd docs/api_reference && uv run --group docs make html uv run --group docs python docs/api_reference/scripts/custom_formatter.py docs/api_reference/_build/html/ diff --git a/docs/api_reference/create_api_rst.py b/docs/api_reference/create_api_rst.py index 663a79d2153..f4c5f977b3f 100644 --- a/docs/api_reference/create_api_rst.py +++ b/docs/api_reference/create_api_rst.py @@ -202,6 +202,12 @@ def _load_package_modules( if file_path.name.startswith("_"): continue + if "integration_template" in file_path.parts: + continue + + if "project_template" in file_path.parts: + continue + relative_module_name = file_path.relative_to(package_path) # Skip if any module part starts with an underscore @@ -495,16 +501,7 @@ def _package_namespace(package_name: str) -> str: def _package_dir(package_name: str = "langchain") -> Path: """Return the path to the directory containing the documentation.""" - if package_name in ( - "langchain", - "langchain_v1", - "experimental", - "community", - "core", - "cli", - "text-splitters", - "standard-tests", - ): + if (ROOT_DIR / "libs" / package_name).exists(): return ROOT_DIR / "libs" / package_name / _package_namespace(package_name) else: return ( @@ -666,18 +663,12 @@ def main(dirs: Optional[list] = None) -> None: print("Starting to build API reference files.") if not dirs: dirs = [ - dir_ - for dir_ in os.listdir(ROOT_DIR / "libs") - if dir_ not in ("cli", "partners", "packages.yml") - and "pyproject.toml" in os.listdir(ROOT_DIR / "libs" / dir_) + p.parent.name + for p in (ROOT_DIR / "libs").rglob("pyproject.toml") + # Exclude packages that are not directly under libs/ or libs/partners/ + if p.parent.parent.name in ("libs", "partners") ] - dirs += [ - dir_ - for dir_ in os.listdir(ROOT_DIR / "libs" / "partners") - if os.path.isdir(ROOT_DIR / "libs" / "partners" / dir_) - and "pyproject.toml" in os.listdir(ROOT_DIR / "libs" / "partners" / dir_) - ] - for dir_ in dirs: + for dir_ in sorted(dirs): # Skip any hidden directories # Some of these could be present by mistake in the code base # e.g., .pytest_cache from running tests from the wrong location. @@ -688,7 +679,7 @@ def main(dirs: Optional[list] = None) -> None: print("Building package:", dir_) _build_rst_file(package_name=dir_) - _build_index(dirs) + _build_index(sorted(dirs)) print("API reference files built.") diff --git a/libs/cli/langchain_cli/cli.py b/libs/cli/langchain_cli/cli.py index d7a500d593b..15c5641e964 100644 --- a/libs/cli/langchain_cli/cli.py +++ b/libs/cli/langchain_cli/cli.py @@ -67,12 +67,11 @@ def serve( ] = None, ) -> None: """Start the LangServe app, whether it's a template or an app.""" - # see if is a template try: project_dir = get_package_root() pyproject = project_dir / "pyproject.toml" get_langserve_export(pyproject) - except KeyError: + except (KeyError, FileNotFoundError): # not a template app_namespace.serve(port=port, host=host) else: diff --git a/libs/cli/uv.lock b/libs/cli/uv.lock index 8fa7dd1ca3f..cdc1e972ff2 100644 --- a/libs/cli/uv.lock +++ b/libs/cli/uv.lock @@ -408,7 +408,7 @@ wheels = [ [[package]] name = "langchain" -version = "0.3.26" +version = "0.3.27" source = { editable = "../langchain" } dependencies = [ { name = "async-timeout", marker = "python_full_version < '3.11'" }, diff --git a/libs/partners/chroma/langchain_chroma/__init__.py b/libs/partners/chroma/langchain_chroma/__init__.py index 836ed3fb854..27d97164bb9 100644 --- a/libs/partners/chroma/langchain_chroma/__init__.py +++ b/libs/partners/chroma/langchain_chroma/__init__.py @@ -1,8 +1,3 @@ -"""This is the langchain_chroma package. - -It contains the Chroma class for handling various tasks. -""" - from langchain_chroma.vectorstores import Chroma __all__ = [ diff --git a/libs/partners/perplexity/langchain_perplexity/__init__.py b/libs/partners/perplexity/langchain_perplexity/__init__.py index 1ea258a47e5..bb7239061e4 100644 --- a/libs/partners/perplexity/langchain_perplexity/__init__.py +++ b/libs/partners/perplexity/langchain_perplexity/__init__.py @@ -1,5 +1,3 @@ -"""This package provides the Perplexity integration for LangChain.""" - from langchain_perplexity.chat_models import ChatPerplexity __all__ = ["ChatPerplexity"] diff --git a/libs/partners/xai/langchain_xai/__init__.py b/libs/partners/xai/langchain_xai/__init__.py index 9227bd8efca..185dca1f042 100644 --- a/libs/partners/xai/langchain_xai/__init__.py +++ b/libs/partners/xai/langchain_xai/__init__.py @@ -1,5 +1,3 @@ -"""This package provides the xAI integration for LangChain.""" - from langchain_xai.chat_models import ChatXAI __all__ = ["ChatXAI"] diff --git a/libs/partners/xai/pyproject.toml b/libs/partners/xai/pyproject.toml index 65bc6b5a547..c1bd6005d37 100644 --- a/libs/partners/xai/pyproject.toml +++ b/libs/partners/xai/pyproject.toml @@ -55,7 +55,7 @@ target-version = "py39" [tool.ruff.lint] select = ["E", "F", "I", "D", "UP", "S"] -ignore = [ "UP007", ] +ignore = [ "UP007", "D104", ] [tool.coverage.run] omit = ["tests/*"] @@ -79,4 +79,4 @@ convention = "google" "tests/**/*.py" = [ "S101", # Tests need assertions "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -] \ No newline at end of file +] diff --git a/libs/standard-tests/langchain_tests/__init__.py b/libs/standard-tests/langchain_tests/__init__.py index 3ed49369923..b03553e9cd7 100644 --- a/libs/standard-tests/langchain_tests/__init__.py +++ b/libs/standard-tests/langchain_tests/__init__.py @@ -1,6 +1,6 @@ """Base Test classes for standard testing. To learn how to use these classes, see the -`Integration standard testing `_ +`integration standard testing `__ guide. """