Skip to content

Commit ceca38d

Browse files
authored
fix(langchain): add test to verify version (#34644)
verify version in langchain to avoid accidental drift
1 parent 5554a36 commit ceca38d

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Main entrypoint into LangChain."""
22

3-
__version__ = "1.2.0"
3+
__version__ = "1.2.2"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""Test that package version is consistent across configuration files."""
2+
3+
from pathlib import Path
4+
5+
import toml
6+
7+
import langchain
8+
9+
10+
def test_version_matches_pyproject() -> None:
11+
"""Verify that __version__ in __init__.py matches version in pyproject.toml."""
12+
# Get the version from the package __init__.py
13+
init_version = langchain.__version__
14+
15+
# Read the version from pyproject.toml
16+
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
17+
with pyproject_path.open() as f:
18+
pyproject_data = toml.load(f)
19+
20+
pyproject_version = pyproject_data["project"]["version"]
21+
22+
# Assert they match
23+
assert init_version == pyproject_version, (
24+
f"Version mismatch: __init__.py has '{init_version}' but "
25+
f"pyproject.toml has '{pyproject_version}'. "
26+
f"Please update langchain/__init__.py to match pyproject.toml."
27+
)

0 commit comments

Comments
 (0)