sys_info.py — langchain Source File
Architecture documentation for sys_info.py, a python file in the langchain codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2bcdd6e0_75d4_11ae_f64b_12df138edcea["sys_info.py"] f7e87ee1_9877_33a0_72c5_d7a9b0e603a3["pkgutil"] 2bcdd6e0_75d4_11ae_f64b_12df138edcea --> f7e87ee1_9877_33a0_72c5_d7a9b0e603a3 bafc65fd_0da5_0339_ed9e_2a63d33bf8c1["platform"] 2bcdd6e0_75d4_11ae_f64b_12df138edcea --> bafc65fd_0da5_0339_ed9e_2a63d33bf8c1 67ec3255_645e_8b6e_1eff_1eb3c648ed95["re"] 2bcdd6e0_75d4_11ae_f64b_12df138edcea --> 67ec3255_645e_8b6e_1eff_1eb3c648ed95 d76a28c2_c3ab_00a8_5208_77807a49449d["sys"] 2bcdd6e0_75d4_11ae_f64b_12df138edcea --> d76a28c2_c3ab_00a8_5208_77807a49449d cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] 2bcdd6e0_75d4_11ae_f64b_12df138edcea --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 3888b2bf_bffe_7c16_770f_a406d400119c["importlib"] 2bcdd6e0_75d4_11ae_f64b_12df138edcea --> 3888b2bf_bffe_7c16_770f_a406d400119c style 2bcdd6e0_75d4_11ae_f64b_12df138edcea fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Print information about the system and langchain packages for debugging purposes."""
import pkgutil
import platform
import re
import sys
from collections.abc import Sequence
from importlib import metadata, util
def _get_sub_deps(packages: Sequence[str]) -> list[str]:
"""Get any specified sub-dependencies."""
sub_deps = set()
underscored_packages = {pkg.replace("-", "_") for pkg in packages}
for pkg in packages:
try:
required = metadata.requires(pkg)
except metadata.PackageNotFoundError:
continue
if not required:
continue
for req in required:
# Extract package name (e.g., "httpx<1,>=0.23.0" -> "httpx")
match = re.match(r"^([a-zA-Z0-9_.-]+)", req)
if match:
pkg_name = match.group(1)
if pkg_name.replace("-", "_") not in underscored_packages:
sub_deps.add(pkg_name)
return sorted(sub_deps, key=lambda x: x.lower())
def print_sys_info(*, additional_pkgs: Sequence[str] = ()) -> None:
"""Print information about the environment for debugging purposes.
Args:
additional_pkgs: Additional packages to include in the output.
"""
# Packages that do not start with "langchain" prefix.
other_langchain_packages = [
"langserve",
"langsmith",
]
langchain_pkgs = [
name for _, name, _ in pkgutil.iter_modules() if name.startswith("langchain")
]
langgraph_pkgs = [
name for _, name, _ in pkgutil.iter_modules() if name.startswith("langgraph")
]
all_packages = sorted(
set(
langchain_pkgs
+ langgraph_pkgs
+ other_langchain_packages
// ... (77 more lines)
Domain
Subdomains
Functions
Dependencies
- collections.abc
- importlib
- pkgutil
- platform
- re
- sys
Source
Frequently Asked Questions
What does sys_info.py do?
sys_info.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in sys_info.py?
sys_info.py defines 2 function(s): _get_sub_deps, print_sys_info.
What does sys_info.py depend on?
sys_info.py imports 6 module(s): collections.abc, importlib, pkgutil, platform, re, sys.
Where is sys_info.py in the architecture?
sys_info.py is located at libs/core/langchain_core/sys_info.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/langchain_core).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free