mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-21 10:26:57 +00:00
fix(docs): local API reference documentation build (#32271)
ensure all relevant packages are correctly processed - cli wasn't included, also fix ValueError
This commit is contained in:
parent
ed682ae62d
commit
12c0e9b7d8
1
Makefile
1
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/
|
||||
|
@ -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.")
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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'" },
|
||||
|
@ -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__ = [
|
||||
|
@ -1,5 +1,3 @@
|
||||
"""This package provides the Perplexity integration for LangChain."""
|
||||
|
||||
from langchain_perplexity.chat_models import ChatPerplexity
|
||||
|
||||
__all__ = ["ChatPerplexity"]
|
||||
|
@ -1,5 +1,3 @@
|
||||
"""This package provides the xAI integration for LangChain."""
|
||||
|
||||
from langchain_xai.chat_models import ChatXAI
|
||||
|
||||
__all__ = ["ChatXAI"]
|
||||
|
@ -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/*"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Base Test classes for standard testing.
|
||||
|
||||
To learn how to use these classes, see the
|
||||
`Integration standard testing <https://python.langchain.com/docs/contributing/how_to/integrations/standard_tests/>`_
|
||||
`integration standard testing <https://python.langchain.com/docs/contributing/how_to/integrations/standard_tests/>`__
|
||||
guide.
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user