mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-20 05:43:55 +00:00
infra: remove core from min version pr testing (#24507)
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
parent
884f76e05a
commit
1f01c0fd98
12
.github/scripts/get_min_versions.py
vendored
12
.github/scripts/get_min_versions.py
vendored
@ -17,6 +17,8 @@ MIN_VERSION_LIBS = [
|
|||||||
"SQLAlchemy",
|
"SQLAlchemy",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
SKIP_IF_PULL_REQUEST = ["langchain-core"]
|
||||||
|
|
||||||
|
|
||||||
def get_min_version(version: str) -> str:
|
def get_min_version(version: str) -> str:
|
||||||
# base regex for x.x.x with cases for rc/post/etc
|
# base regex for x.x.x with cases for rc/post/etc
|
||||||
@ -43,7 +45,7 @@ def get_min_version(version: str) -> str:
|
|||||||
raise ValueError(f"Unrecognized version format: {version}")
|
raise ValueError(f"Unrecognized version format: {version}")
|
||||||
|
|
||||||
|
|
||||||
def get_min_version_from_toml(toml_path: str):
|
def get_min_version_from_toml(toml_path: str, versions_for: str):
|
||||||
# Parse the TOML file
|
# Parse the TOML file
|
||||||
with open(toml_path, "rb") as file:
|
with open(toml_path, "rb") as file:
|
||||||
toml_data = tomllib.load(file)
|
toml_data = tomllib.load(file)
|
||||||
@ -56,6 +58,10 @@ def get_min_version_from_toml(toml_path: str):
|
|||||||
|
|
||||||
# Iterate over the libs in MIN_VERSION_LIBS
|
# Iterate over the libs in MIN_VERSION_LIBS
|
||||||
for lib in MIN_VERSION_LIBS:
|
for lib in MIN_VERSION_LIBS:
|
||||||
|
if versions_for == "pull_request" and lib in SKIP_IF_PULL_REQUEST:
|
||||||
|
# some libs only get checked on release because of simultaneous
|
||||||
|
# changes
|
||||||
|
continue
|
||||||
# Check if the lib is present in the dependencies
|
# Check if the lib is present in the dependencies
|
||||||
if lib in dependencies:
|
if lib in dependencies:
|
||||||
# Get the version string
|
# Get the version string
|
||||||
@ -76,8 +82,10 @@ def get_min_version_from_toml(toml_path: str):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Get the TOML file path from the command line argument
|
# Get the TOML file path from the command line argument
|
||||||
toml_file = sys.argv[1]
|
toml_file = sys.argv[1]
|
||||||
|
versions_for = sys.argv[2]
|
||||||
|
assert versions_for in ["release", "pull_request"]
|
||||||
|
|
||||||
# Call the function to get the minimum versions
|
# Call the function to get the minimum versions
|
||||||
min_versions = get_min_version_from_toml(toml_file)
|
min_versions = get_min_version_from_toml(toml_file, versions_for)
|
||||||
|
|
||||||
print(" ".join([f"{lib}=={version}" for lib, version in min_versions.items()]))
|
print(" ".join([f"{lib}=={version}" for lib, version in min_versions.items()]))
|
||||||
|
2
.github/workflows/_release.yml
vendored
2
.github/workflows/_release.yml
vendored
@ -231,7 +231,7 @@ jobs:
|
|||||||
id: min-version
|
id: min-version
|
||||||
run: |
|
run: |
|
||||||
poetry run pip install packaging
|
poetry run pip install packaging
|
||||||
min_versions="$(poetry run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml)"
|
min_versions="$(poetry run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml release)"
|
||||||
echo "min-versions=$min_versions" >> "$GITHUB_OUTPUT"
|
echo "min-versions=$min_versions" >> "$GITHUB_OUTPUT"
|
||||||
echo "min-versions=$min_versions"
|
echo "min-versions=$min_versions"
|
||||||
|
|
||||||
|
2
.github/workflows/_test.yml
vendored
2
.github/workflows/_test.yml
vendored
@ -71,7 +71,7 @@ jobs:
|
|||||||
id: min-version
|
id: min-version
|
||||||
run: |
|
run: |
|
||||||
poetry run pip install packaging tomli
|
poetry run pip install packaging tomli
|
||||||
min_versions="$(poetry run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml)"
|
min_versions="$(poetry run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml pull_request)"
|
||||||
echo "min-versions=$min_versions" >> "$GITHUB_OUTPUT"
|
echo "min-versions=$min_versions" >> "$GITHUB_OUTPUT"
|
||||||
echo "min-versions=$min_versions"
|
echo "min-versions=$min_versions"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user