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
  06661442_038e_b46d_78bf_48e3415d8d56["main()"]
  38914e20_32e7_35e1_71af_1a3b2e7d5416["check_version.py"]
  06661442_038e_b46d_78bf_48e3415d8d56 -->|defined in| 38914e20_32e7_35e1_71af_1a3b2e7d5416
  f93eab3e_33c9_2a17_189c_f623a8825ef9["sys()"]
  f93eab3e_33c9_2a17_189c_f623a8825ef9 -->|calls| 06661442_038e_b46d_78bf_48e3415d8d56
  3bf46656_01e8_29bf_28c2_0a2b6164bcc8["get_pyproject_version()"]
  06661442_038e_b46d_78bf_48e3415d8d56 -->|calls| 3bf46656_01e8_29bf_28c2_0a2b6164bcc8
  aa3e2c9a_3150_1e34_78d5_e8bcfdc912a6["get_init_version()"]
  06661442_038e_b46d_78bf_48e3415d8d56 -->|calls| aa3e2c9a_3150_1e34_78d5_e8bcfdc912a6
  style 06661442_038e_b46d_78bf_48e3415d8d56 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/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"
    init_path = package_dir / "langchain" / "__init__.py"

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

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

    pyproject_version = get_pyproject_version(pyproject_path)
    init_version = get_init_version(init_path)

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

    if init_version is None:
        print("Error: Could not find __version__ in langchain/__init__.py")  # noqa: T201
        return 1

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

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

Domain

Subdomains

Called By

Frequently Asked Questions

What does main() do?
main() is a function in the langchain codebase, defined in libs/langchain_v1/scripts/check_version.py.
Where is main() defined?
main() is defined in libs/langchain_v1/scripts/check_version.py at line 27.
What does main() call?
main() calls 2 function(s): get_init_version, get_pyproject_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