Home / Function/ main() — langchain Function Reference

main() — langchain Function Reference

Architecture documentation for the main() function in check_version.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  2411311a_00a0_170d_20d5_a8e3b6af05eb["main()"]
  90a69730_b824_7e80_91bd_250a432f202f["check_version.py"]
  2411311a_00a0_170d_20d5_a8e3b6af05eb -->|defined in| 90a69730_b824_7e80_91bd_250a432f202f
  1494a74b_2997_5835_447b_8777333a33b3["sys()"]
  1494a74b_2997_5835_447b_8777333a33b3 -->|calls| 2411311a_00a0_170d_20d5_a8e3b6af05eb
  64cdb898_988b_0281_b2a5_cd2c90b617f9["get_pyproject_version()"]
  2411311a_00a0_170d_20d5_a8e3b6af05eb -->|calls| 64cdb898_988b_0281_b2a5_cd2c90b617f9
  87ca2de9_10e6_aef7_c39a_8fd298a2a3a1["get_version_py_version()"]
  2411311a_00a0_170d_20d5_a8e3b6af05eb -->|calls| 87ca2de9_10e6_aef7_c39a_8fd298a2a3a1
  style 2411311a_00a0_170d_20d5_a8e3b6af05eb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/scripts/check_version.py lines 27–61

def main() -> int:
    """Validate version consistency."""
    script_dir = Path(__file__).parent
    package_dir = script_dir.parent

    pyproject_path = package_dir / "pyproject.toml"
    version_path = package_dir / "langchain_core" / "version.py"

    if not pyproject_path.exists():
        print(f"Error: {pyproject_path} not found")  # noqa: T201
        return 1

    if not version_path.exists():
        print(f"Error: {version_path} not found")  # noqa: T201
        return 1

    pyproject_version = get_pyproject_version(pyproject_path)
    version_py_version = get_version_py_version(version_path)

    if pyproject_version is None:
        print("Error: Could not find version in pyproject.toml")  # noqa: T201
        return 1

    if version_py_version is None:
        print("Error: Could not find VERSION in langchain_core/version.py")  # noqa: T201
        return 1

    if pyproject_version != version_py_version:
        print("Error: Version mismatch detected!")  # noqa: T201
        print(f"  pyproject.toml: {pyproject_version}")  # noqa: T201
        print(f"  langchain_core/version.py: {version_py_version}")  # noqa: T201
        return 1

    print(f"Version check passed: {pyproject_version}")  # noqa: T201
    return 0

Subdomains

Called By

Frequently Asked Questions

What does main() do?
main() is a function in the langchain codebase, defined in libs/core/scripts/check_version.py.
Where is main() defined?
main() is defined in libs/core/scripts/check_version.py at line 27.
What does main() call?
main() calls 2 function(s): get_pyproject_version, get_version_py_version.
What calls main()?
main() is called by 1 function(s): sys.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free