From ceca38d3fe8c69da216f4214cfb38bd924cb3098 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Wed, 7 Jan 2026 17:36:10 -0500 Subject: [PATCH] fix(langchain): add test to verify version (#34644) verify version in langchain to avoid accidental drift --- libs/langchain_v1/langchain/__init__.py | 2 +- .../tests/unit_tests/test_version.py | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 libs/langchain_v1/tests/unit_tests/test_version.py diff --git a/libs/langchain_v1/langchain/__init__.py b/libs/langchain_v1/langchain/__init__.py index 97f2af95439..a9835e787c1 100644 --- a/libs/langchain_v1/langchain/__init__.py +++ b/libs/langchain_v1/langchain/__init__.py @@ -1,3 +1,3 @@ """Main entrypoint into LangChain.""" -__version__ = "1.2.0" +__version__ = "1.2.2" diff --git a/libs/langchain_v1/tests/unit_tests/test_version.py b/libs/langchain_v1/tests/unit_tests/test_version.py new file mode 100644 index 00000000000..d4bac40dedc --- /dev/null +++ b/libs/langchain_v1/tests/unit_tests/test_version.py @@ -0,0 +1,27 @@ +"""Test that package version is consistent across configuration files.""" + +from pathlib import Path + +import toml + +import langchain + + +def test_version_matches_pyproject() -> None: + """Verify that __version__ in __init__.py matches version in pyproject.toml.""" + # Get the version from the package __init__.py + init_version = langchain.__version__ + + # Read the version from pyproject.toml + pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml" + with pyproject_path.open() as f: + pyproject_data = toml.load(f) + + pyproject_version = pyproject_data["project"]["version"] + + # Assert they match + assert init_version == pyproject_version, ( + f"Version mismatch: __init__.py has '{init_version}' but " + f"pyproject.toml has '{pyproject_version}'. " + f"Please update langchain/__init__.py to match pyproject.toml." + )