Files
langflow/scripts/ci/update_uv_dependency.py
Jordan Frazier a097b685fd ci: add hash history script to nightly workflow (#11409)
* Add nightly hash history script to nightly workflow

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* Add lfx-nightly to script

* Handle first run

* Try fixing version on nightly hash history

* remove lfx lockfile since it does not exist

* Get full version in build, handle the [extras] in pyprojects

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* language update

* Handle extras in langflow-base dependency in all workflows

* [autofix.ci] apply automated fixes

* Fix import in lfx status response

* [autofix.ci] apply automated fixes

* Use built artifact for jobs, remove wait period

* use [complete] when building test cli job

* skip slack message added to success

* Update merge hash histry job to only run when ref is main

* Updates pyproject naming to add nightly suffix

* [autofix.ci] apply automated fixes

* Fix ordering of lfx imports'

* [autofix.ci] apply automated fixes

* Ah, ignore auto-import fixes by ruff

* [autofix.ci] apply automated fixes

* update test to look at _all_ exported instead

* [autofix.ci] apply automated fixes

* perf: Limit enum options in tool schemas to reduce token usage (#11370)

* fix current date tokens usage

* Update src/lfx/src/lfx/io/schema.py

* remove comment

---------

Co-authored-by: Himavarsha <40851462+HimavarshaVS@users.noreply.github.com>

* update date test to reflect changes to lfx

* ruff

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
Co-authored-by: Himavarsha <40851462+HimavarshaVS@users.noreply.github.com>
2026-01-27 16:27:59 +00:00

55 lines
1.7 KiB
Python
Executable File

#!/usr/bin/env python
import re
import sys
from pathlib import Path
BASE_DIR = Path(__file__).parent.parent.parent
ARGUMENT_NUMBER = 2
def update_uv_dep(base_version: str) -> None:
"""Update the langflow-base dependency in pyproject.toml."""
pyproject_path = BASE_DIR / "pyproject.toml"
# Read the pyproject.toml file content
content = pyproject_path.read_text(encoding="utf-8")
# For the main project, update the langflow-base dependency in the UV section
# Updated pattern to handle PEP 440 version suffixes, extras (e.g., [complete]),
# and both ~= and == version specifiers
# Also handles both langflow-base and langflow-base-nightly names
# Captures extras in group 3 to preserve them in the replacement
pattern = re.compile(
r'(dependencies\s*=\s*\[\s*\n\s*)("langflow-base(?:-nightly)?((?:\[[^\]]+\])?)(?:~=|==)[\d.]+(?:\.(?:post|dev|a|b|rc)\d+)*")'
)
# Check if the pattern is found
match = pattern.search(content)
if not match:
msg = f"{pattern} UV dependency not found in {pyproject_path}"
raise ValueError(msg)
# Extract extras if present (e.g., "[complete]")
extras = match.group(3) if match.group(3) else ""
replacement = rf'\1"langflow-base-nightly{extras}=={base_version}"'
# Replace the matched pattern with the new one
content = pattern.sub(replacement, content)
# Write the updated content back to the file
pyproject_path.write_text(content, encoding="utf-8")
def main() -> None:
if len(sys.argv) != ARGUMENT_NUMBER:
msg = "specify base version"
raise ValueError(msg)
base_version = sys.argv[1]
base_version = base_version.lstrip("v")
update_uv_dep(base_version)
if __name__ == "__main__":
main()