mirror of
https://github.com/hanzoai/flow.git
synced 2026-10-17 01:29:18 +00:00
Single generic package name for white-label compatibility. - git mv src/backend/base/hanzoflow/ -> src/backend/base/flow/ - git rm src/backend/base/langflow/ (compat shim, no longer needed) - git mv src/backend/hanzoflow/ -> src/backend/flow/ (root package) - Rename langflow_launcher.py -> launcher.py - Update all Python imports: from langflow/hanzoflow -> from flow - Update all string module references in mock targets, JSON data files - Update pyproject.toml entry points, hatch build targets, mypy/codeflash config - Update Dockerfile, Makefile, compose files, CI workflows, codecov.yml - Rename internal classes: HanzoflowApplication -> FlowApplication, etc. - Update alembic.ini database name - Keep PyPI package names (hanzoflow, langflow-base) unchanged - Keep LANGFLOW_* env var names for backwards compatibility
89 lines
2.9 KiB
Python
Executable File
89 lines
2.9 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import packaging.version
|
|
|
|
BASE_DIR = Path(__file__).parent.parent.parent
|
|
ARGUMENT_NUMBER = 3
|
|
|
|
|
|
def update_base_dep(pyproject_path: str, new_version: str) -> None:
|
|
"""Update the flow-base dependency in pyproject.toml."""
|
|
filepath = BASE_DIR / pyproject_path
|
|
content = filepath.read_text(encoding="utf-8")
|
|
|
|
# Updated pattern to handle PEP 440 version suffixes, extras (e.g., [complete]),
|
|
# both ~= and == version specifiers, and both flow-base and flow-base-nightly names
|
|
# Captures extras in group 2 to preserve them in the replacement
|
|
pattern = re.compile(r'("flow-base(?:-nightly)?((?:\[[^\]]+\])?)(?:~=|==)[\d.]+(?:\.(?:post|dev|a|b|rc)\d+)*")')
|
|
|
|
# Check if the pattern is found
|
|
match = pattern.search(content)
|
|
if not match:
|
|
msg = f'flow-base dependency not found in "{filepath}"'
|
|
raise ValueError(msg)
|
|
|
|
# Extract extras if present (e.g., "[complete]")
|
|
extras = match.group(2) if match.group(2) else ""
|
|
replacement = f'"flow-base-nightly{extras}=={new_version}"'
|
|
|
|
# Replace the matched pattern with the new one
|
|
content = pattern.sub(replacement, content)
|
|
filepath.write_text(content, encoding="utf-8")
|
|
|
|
|
|
def update_lfx_dep_in_base(pyproject_path: str, lfx_version: str) -> None:
|
|
"""Update the LFX dependency in flow-base pyproject.toml to use nightly version."""
|
|
filepath = BASE_DIR / pyproject_path
|
|
content = filepath.read_text(encoding="utf-8")
|
|
|
|
# Updated pattern to handle PEP 440 version suffixes, both ~= and == version specifiers,
|
|
# and both lfx and lfx-nightly names
|
|
pattern = re.compile(r'("lfx(?:-nightly)?(?:~=|==)[\d.]+(?:\.(?:post|dev|a|b|rc)\d+)*")')
|
|
replacement = f'"lfx-nightly=={lfx_version}"'
|
|
|
|
# Check if the pattern is found
|
|
if not pattern.search(content):
|
|
msg = f'LFX dependency not found in "{filepath}"'
|
|
raise ValueError(msg)
|
|
|
|
# Replace the matched pattern with the new one
|
|
content = pattern.sub(replacement, content)
|
|
filepath.write_text(content, encoding="utf-8")
|
|
|
|
|
|
def verify_pep440(version):
|
|
"""Verify if version is PEP440 compliant.
|
|
|
|
https://github.com/pypa/packaging/blob/16.7/packaging/version.py#L191
|
|
"""
|
|
return packaging.version.Version(version)
|
|
|
|
|
|
def main() -> None:
|
|
if len(sys.argv) != ARGUMENT_NUMBER:
|
|
msg = "Usage: update_lf_base_dependency.py <base_version> <lfx_version>"
|
|
raise ValueError(msg)
|
|
base_version = sys.argv[1]
|
|
lfx_version = sys.argv[2]
|
|
|
|
# Strip "v" prefix from versions if present
|
|
base_version = base_version.removeprefix("v")
|
|
lfx_version = lfx_version.removeprefix("v")
|
|
|
|
verify_pep440(base_version)
|
|
verify_pep440(lfx_version)
|
|
|
|
# Update flow-base dependency in main project
|
|
update_base_dep("pyproject.toml", base_version)
|
|
|
|
# Update LFX dependency in flow-base
|
|
update_lfx_dep_in_base("src/backend/base/pyproject.toml", lfx_version)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|