mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-23 03:22:38 +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: Build the API Reference documentation.
|
||||||
api_docs_build: clean
|
api_docs_build: clean
|
||||||
@echo "📖 Building API Reference documentation..."
|
@echo "📖 Building API Reference documentation..."
|
||||||
|
uv pip install -e libs/cli
|
||||||
uv run --group docs python docs/api_reference/create_api_rst.py
|
uv run --group docs python docs/api_reference/create_api_rst.py
|
||||||
cd docs/api_reference && uv run --group docs make html
|
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/
|
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("_"):
|
if file_path.name.startswith("_"):
|
||||||
continue
|
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)
|
relative_module_name = file_path.relative_to(package_path)
|
||||||
|
|
||||||
# Skip if any module part starts with an underscore
|
# 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:
|
def _package_dir(package_name: str = "langchain") -> Path:
|
||||||
"""Return the path to the directory containing the documentation."""
|
"""Return the path to the directory containing the documentation."""
|
||||||
if package_name in (
|
if (ROOT_DIR / "libs" / package_name).exists():
|
||||||
"langchain",
|
|
||||||
"langchain_v1",
|
|
||||||
"experimental",
|
|
||||||
"community",
|
|
||||||
"core",
|
|
||||||
"cli",
|
|
||||||
"text-splitters",
|
|
||||||
"standard-tests",
|
|
||||||
):
|
|
||||||
return ROOT_DIR / "libs" / package_name / _package_namespace(package_name)
|
return ROOT_DIR / "libs" / package_name / _package_namespace(package_name)
|
||||||
else:
|
else:
|
||||||
return (
|
return (
|
||||||
@ -666,18 +663,12 @@ def main(dirs: Optional[list] = None) -> None:
|
|||||||
print("Starting to build API reference files.")
|
print("Starting to build API reference files.")
|
||||||
if not dirs:
|
if not dirs:
|
||||||
dirs = [
|
dirs = [
|
||||||
dir_
|
p.parent.name
|
||||||
for dir_ in os.listdir(ROOT_DIR / "libs")
|
for p in (ROOT_DIR / "libs").rglob("pyproject.toml")
|
||||||
if dir_ not in ("cli", "partners", "packages.yml")
|
# Exclude packages that are not directly under libs/ or libs/partners/
|
||||||
and "pyproject.toml" in os.listdir(ROOT_DIR / "libs" / dir_)
|
if p.parent.parent.name in ("libs", "partners")
|
||||||
]
|
]
|
||||||
dirs += [
|
for dir_ in sorted(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:
|
|
||||||
# Skip any hidden directories
|
# Skip any hidden directories
|
||||||
# Some of these could be present by mistake in the code base
|
# Some of these could be present by mistake in the code base
|
||||||
# e.g., .pytest_cache from running tests from the wrong location.
|
# 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_)
|
print("Building package:", dir_)
|
||||||
_build_rst_file(package_name=dir_)
|
_build_rst_file(package_name=dir_)
|
||||||
|
|
||||||
_build_index(dirs)
|
_build_index(sorted(dirs))
|
||||||
print("API reference files built.")
|
print("API reference files built.")
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,12 +67,11 @@ def serve(
|
|||||||
] = None,
|
] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Start the LangServe app, whether it's a template or an app."""
|
"""Start the LangServe app, whether it's a template or an app."""
|
||||||
# see if is a template
|
|
||||||
try:
|
try:
|
||||||
project_dir = get_package_root()
|
project_dir = get_package_root()
|
||||||
pyproject = project_dir / "pyproject.toml"
|
pyproject = project_dir / "pyproject.toml"
|
||||||
get_langserve_export(pyproject)
|
get_langserve_export(pyproject)
|
||||||
except KeyError:
|
except (KeyError, FileNotFoundError):
|
||||||
# not a template
|
# not a template
|
||||||
app_namespace.serve(port=port, host=host)
|
app_namespace.serve(port=port, host=host)
|
||||||
else:
|
else:
|
||||||
|
@ -408,7 +408,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "langchain"
|
name = "langchain"
|
||||||
version = "0.3.26"
|
version = "0.3.27"
|
||||||
source = { editable = "../langchain" }
|
source = { editable = "../langchain" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "async-timeout", marker = "python_full_version < '3.11'" },
|
{ 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
|
from langchain_chroma.vectorstores import Chroma
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
"""This package provides the Perplexity integration for LangChain."""
|
|
||||||
|
|
||||||
from langchain_perplexity.chat_models import ChatPerplexity
|
from langchain_perplexity.chat_models import ChatPerplexity
|
||||||
|
|
||||||
__all__ = ["ChatPerplexity"]
|
__all__ = ["ChatPerplexity"]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
"""This package provides the xAI integration for LangChain."""
|
|
||||||
|
|
||||||
from langchain_xai.chat_models import ChatXAI
|
from langchain_xai.chat_models import ChatXAI
|
||||||
|
|
||||||
__all__ = ["ChatXAI"]
|
__all__ = ["ChatXAI"]
|
||||||
|
@ -55,7 +55,7 @@ target-version = "py39"
|
|||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
select = ["E", "F", "I", "D", "UP", "S"]
|
select = ["E", "F", "I", "D", "UP", "S"]
|
||||||
ignore = [ "UP007", ]
|
ignore = [ "UP007", "D104", ]
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
omit = ["tests/*"]
|
omit = ["tests/*"]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Base Test classes for standard testing.
|
"""Base Test classes for standard testing.
|
||||||
|
|
||||||
To learn how to use these classes, see the
|
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.
|
guide.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user