mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 06:39:52 +00:00
docs: more useful vercel warnings (#28699)
This commit is contained in:
parent
f60110107c
commit
48ab91b520
@ -13,28 +13,21 @@ OUTPUT_NEW_DOCS_DIR = $(OUTPUT_NEW_DIR)/docs
|
|||||||
|
|
||||||
PYTHON = .venv/bin/python
|
PYTHON = .venv/bin/python
|
||||||
|
|
||||||
PARTNER_DEPS_LIST := $(shell find ../libs/partners -mindepth 1 -maxdepth 1 -type d -exec sh -c ' \
|
|
||||||
for dir; do \
|
|
||||||
if find "$$dir" -maxdepth 1 -type f \( -name "pyproject.toml" -o -name "setup.py" \) | grep -q .; then \
|
|
||||||
echo "$$dir"; \
|
|
||||||
fi \
|
|
||||||
done' sh {} + | grep -vE "airbyte|ibm|databricks" | tr '\n' ' ')
|
|
||||||
|
|
||||||
PORT ?= 3001
|
PORT ?= 3001
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
|
||||||
install-vercel-deps:
|
install-vercel-deps:
|
||||||
yum -y update
|
yum -y -q update
|
||||||
yum install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip rsync -y
|
yum -y -q install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip rsync -y
|
||||||
|
|
||||||
install-py-deps:
|
install-py-deps:
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
$(PYTHON) -m pip install --upgrade pip
|
$(PYTHON) -m pip install -q --upgrade pip
|
||||||
$(PYTHON) -m pip install --upgrade uv
|
$(PYTHON) -m pip install -q --upgrade uv
|
||||||
$(PYTHON) -m uv pip install --pre -r vercel_requirements.txt
|
$(PYTHON) -m uv pip install -q --pre -r vercel_requirements.txt
|
||||||
$(PYTHON) -m uv pip install --pre --editable $(PARTNER_DEPS_LIST)
|
$(PYTHON) -m uv pip install -q --pre $$($(PYTHON) scripts/partner_deps_list.py)
|
||||||
|
|
||||||
generate-files:
|
generate-files:
|
||||||
mkdir -p $(INTERMEDIATE_DIR)
|
mkdir -p $(INTERMEDIATE_DIR)
|
||||||
|
@ -5,6 +5,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import warnings
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Literal, Optional
|
from typing import List, Literal, Optional
|
||||||
|
|
||||||
@ -110,16 +111,36 @@ def find_files(path):
|
|||||||
|
|
||||||
def get_full_module_name(module_path, class_name) -> Optional[str]:
|
def get_full_module_name(module_path, class_name) -> Optional[str]:
|
||||||
"""Get full module name using inspect"""
|
"""Get full module name using inspect"""
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("ignore")
|
||||||
try:
|
try:
|
||||||
module = importlib.import_module(module_path)
|
module = importlib.import_module(module_path)
|
||||||
|
except ImportError:
|
||||||
|
# check if it's a submodule
|
||||||
|
try:
|
||||||
|
module = importlib.import_module(module_path + "." + class_name)
|
||||||
|
except ImportError:
|
||||||
|
raise ValueError(f"Failed to import module {module_path}")
|
||||||
|
return module.__name__
|
||||||
|
|
||||||
|
try:
|
||||||
class_ = getattr(module, class_name)
|
class_ = getattr(module, class_name)
|
||||||
return inspect.getmodule(class_).__name__
|
except AttributeError:
|
||||||
except AttributeError as e:
|
# check if it's a submodule
|
||||||
logger.warning(f"Could not find module for {class_name}, {e}")
|
try:
|
||||||
return None
|
module = importlib.import_module(module_path + "." + class_name)
|
||||||
except ImportError as e:
|
except ImportError:
|
||||||
logger.warning(f"Failed to load for class {class_name}, {e}")
|
raise ValueError(
|
||||||
|
f"Failed to import class {class_name} from module {module_path}"
|
||||||
|
)
|
||||||
|
return module.__name__
|
||||||
|
|
||||||
|
inspectmodule = inspect.getmodule(class_)
|
||||||
|
if inspectmodule is None:
|
||||||
|
# it wasn't a class, it's a primitive (e.g. END="__end__")
|
||||||
|
# so no documentation link is necessary
|
||||||
return None
|
return None
|
||||||
|
return inspectmodule.__name__
|
||||||
|
|
||||||
|
|
||||||
def get_args() -> argparse.Namespace:
|
def get_args() -> argparse.Namespace:
|
||||||
@ -228,7 +249,17 @@ def _get_imports(
|
|||||||
if imp.strip()
|
if imp.strip()
|
||||||
]
|
]
|
||||||
for class_name in imported_classes:
|
for class_name in imported_classes:
|
||||||
|
try:
|
||||||
module_path = get_full_module_name(module, class_name)
|
module_path = get_full_module_name(module, class_name)
|
||||||
|
except ValueError as e:
|
||||||
|
logger.warning(e)
|
||||||
|
continue
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(
|
||||||
|
f"Failed to get full module name for {module}.{class_name}"
|
||||||
|
)
|
||||||
|
logger.error(e)
|
||||||
|
continue
|
||||||
if not module_path:
|
if not module_path:
|
||||||
continue
|
continue
|
||||||
if len(module_path.split(".")) < 2:
|
if len(module_path.split(".")) < 2:
|
||||||
|
26
docs/scripts/partner_deps_list.py
Normal file
26
docs/scripts/partner_deps_list.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import yaml
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
with open("../libs/packages.yml", "r") as f:
|
||||||
|
packages_yaml = yaml.safe_load(f)
|
||||||
|
|
||||||
|
packages = packages_yaml["packages"]
|
||||||
|
|
||||||
|
comaintain_packages = [
|
||||||
|
p
|
||||||
|
for p in packages
|
||||||
|
if not p.get("disabled", False)
|
||||||
|
and p["repo"].startswith("langchain-ai/")
|
||||||
|
and p["repo"] != "langchain-ai/langchain"
|
||||||
|
]
|
||||||
|
monorepo_packages = [
|
||||||
|
p
|
||||||
|
for p in packages
|
||||||
|
if not p.get("disabled", False) and p["repo"] == "langchain-ai/langchain"
|
||||||
|
]
|
||||||
|
|
||||||
|
for p in monorepo_packages:
|
||||||
|
print("--editable ../" + p["path"])
|
||||||
|
|
||||||
|
for p in comaintain_packages:
|
||||||
|
print(p["name"])
|
@ -1,10 +1,5 @@
|
|||||||
-e ../libs/core
|
|
||||||
-e ../libs/langchain
|
|
||||||
-e ../libs/community
|
|
||||||
-e ../libs/text-splitters
|
|
||||||
langgraph
|
langgraph
|
||||||
pyyaml
|
pyyaml
|
||||||
langchain-cohere
|
|
||||||
urllib3==1.26.19
|
urllib3==1.26.19
|
||||||
nbconvert==7.16.4
|
nbconvert==7.16.4
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ packages:
|
|||||||
repo: langchain-ai/langchain
|
repo: langchain-ai/langchain
|
||||||
path: libs/partners/huggingface
|
path: libs/partners/huggingface
|
||||||
- name: langchain-ibm
|
- name: langchain-ibm
|
||||||
repo: langchain-ai/langchain
|
repo: langchain-ai/langchain-ibm
|
||||||
path: libs/partners/ibm
|
path: libs/ibm
|
||||||
- name: langchain-milvus
|
- name: langchain-milvus
|
||||||
repo: langchain-ai/langchain-milvus
|
repo: langchain-ai/langchain-milvus
|
||||||
path: libs/milvus
|
path: libs/milvus
|
||||||
|
Loading…
Reference in New Issue
Block a user