mirror of
https://github.com/hwchase17/langchain
synced 2024-11-16 06:13:16 +00:00
core[patch]: Update sys info information (#16297)
Update information collected in sys info. python -m langchain_core.sys_info System Information ------------------ > OS: Linux > OS Version: #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 > Python Version: 3.11.4 (main, Sep 25 2023, 10:06:23) [GCC 11.4.0] Package Information ------------------- > langchain_core: 0.1.10 > langchain: 0.1.0 > langchain_community: 0.0.11 > langchain_cli: 0.0.20 > langchain_experimental: 0.0.36 > langchain_openai: 0.0.2 > langchainhub: 0.1.14 > langserve: 0.0.19 Packages not installed (Not Necessarily a Problem) -------------------------------------------------- The following packages were not found: > langgraph
This commit is contained in:
parent
5396604ef4
commit
89372fca22
@ -4,16 +4,32 @@ from typing import Sequence
|
||||
|
||||
def print_sys_info(*, additional_pkgs: Sequence[str] = tuple()) -> None:
|
||||
"""Print information about the environment for debugging purposes."""
|
||||
import pkgutil
|
||||
import platform
|
||||
import sys
|
||||
from importlib import metadata, util
|
||||
|
||||
packages = [
|
||||
"langchain_core",
|
||||
"langchain",
|
||||
"langchain_community",
|
||||
# Packages that do not start with "langchain" prefix.
|
||||
other_langchain_packages = [
|
||||
"langserve",
|
||||
] + list(additional_pkgs)
|
||||
"langgraph",
|
||||
]
|
||||
|
||||
langchain_pkgs = [
|
||||
name for _, name, _ in pkgutil.iter_modules() if name.startswith("langchain")
|
||||
]
|
||||
|
||||
all_packages = sorted(
|
||||
set(langchain_pkgs + other_langchain_packages + list(additional_pkgs))
|
||||
)
|
||||
|
||||
# Always surface these packages to the top
|
||||
order_by = ["langchain_core", "langchain", "langchain_community"]
|
||||
|
||||
for pkg in reversed(order_by):
|
||||
if pkg in all_packages:
|
||||
all_packages.remove(pkg)
|
||||
all_packages = [pkg] + list(all_packages)
|
||||
|
||||
system_info = {
|
||||
"OS": platform.system(),
|
||||
@ -32,13 +48,15 @@ def print_sys_info(*, additional_pkgs: Sequence[str] = tuple()) -> None:
|
||||
print("Package Information")
|
||||
print("-------------------")
|
||||
|
||||
for pkg in packages:
|
||||
not_installed = []
|
||||
|
||||
for pkg in all_packages:
|
||||
try:
|
||||
found_package = util.find_spec(pkg)
|
||||
except Exception:
|
||||
found_package = None
|
||||
if found_package is None:
|
||||
print(f"> {pkg}: Not Found")
|
||||
not_installed.append(pkg)
|
||||
continue
|
||||
|
||||
# Package version
|
||||
@ -51,7 +69,16 @@ def print_sys_info(*, additional_pkgs: Sequence[str] = tuple()) -> None:
|
||||
if package_version is not None:
|
||||
print(f"> {pkg}: {package_version}")
|
||||
else:
|
||||
print(f"> {pkg}: Found")
|
||||
print(f"> {pkg}: Installed. No version info available.")
|
||||
|
||||
if not_installed:
|
||||
print()
|
||||
print("Packages not installed (Not Necessarily a Problem)")
|
||||
print("--------------------------------------------------")
|
||||
print("The following packages were not found:")
|
||||
print()
|
||||
for pkg in not_installed:
|
||||
print(f"> {pkg}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user