From c779d43af3ee0d50b157cd526a3114e34207b0b3 Mon Sep 17 00:00:00 2001 From: tjtanaa Date: Thu, 5 Feb 2026 14:40:59 +0000 Subject: [PATCH 1/4] auto generate version using setuptool_scm Signed-off-by: tjtanaa --- .gitignore | 3 +++ pyproject.toml | 7 ++++-- setup.py | 54 ++++++++++++++++++++++++++++++++++++++++++++ vllm_omni/version.py | 28 ++++++++++++++++++++--- 4 files changed, 87 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f7b771bc73..cf3390782f 100644 --- a/.gitignore +++ b/.gitignore @@ -233,3 +233,6 @@ configs/development.yaml Dockerfile.dev discussion tmp_test + +# Auto-generated version file (created by setuptools_scm during build) +vllm_omni/_version.py diff --git a/pyproject.toml b/pyproject.toml index 706d0152e1..8e9f9bf8b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" [project] name = "vllm-omni" -version = "0.14.0" +dynamic = ["version", "dependencies"] description = "A framework for efficient model inference with omni-modality models" readme = "README.md" requires-python = ">=3.10,<3.14" @@ -17,7 +17,6 @@ authors = [ {name = "vLLM-Omni Team"} ] keywords = ["vllm", "multimodal", "diffusion", "transformer", "inference", "serving"] -dynamic = ["dependencies"] classifiers = [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -85,6 +84,10 @@ include = ["vllm_omni*"] [tool.setuptools.package-data] "vllm_omni.model_executor.stage_configs" = ["*.yaml"] +[tool.setuptools_scm] +# Enable setuptools_scm for automatic version generation from git tags. +# Version is written to vllm_omni/_version.py during build. + [tool.ruff] line-length = 120 exclude = [ diff --git a/setup.py b/setup.py index e33c848a3f..2f404b7108 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ from pathlib import Path from setuptools import setup +from setuptools_scm import get_version def uninstall_onnxruntime() -> None: @@ -104,6 +105,58 @@ def detect_target_device() -> str: return "cuda" +def get_vllm_omni_version() -> str: + """ + Get the vLLM-Omni version with device-specific suffix. + + Version format: {base_version}+{device} + Examples: + - 0.14.0+cuda (release version with CUDA) + - 0.14.1.dev23+g1a2b3c4+rocm (dev version with ROCm) + - 0.15.0+npu (release version with NPU) + + Environment variables: + VLLM_OMNI_VERSION_OVERRIDE: Override version completely + VLLM_OMNI_TARGET_DEVICE: Override device detection + + Returns: + Version string with device suffix + """ + # Allow complete version override via environment variable + if env_version := os.getenv("VLLM_OMNI_VERSION_OVERRIDE"): + print(f"Overriding vLLM-Omni version with {env_version} from VLLM_OMNI_VERSION_OVERRIDE") + os.environ["SETUPTOOLS_SCM_PRETEND_VERSION"] = env_version + return get_version(write_to="vllm_omni/_version.py") + + # Generate version from git tags via setuptools_scm + try: + version = get_version(write_to="vllm_omni/_version.py") + except Exception as e: + print(f"Warning: Failed to get version from git, using fallback: {e}") + version = "dev" + + # Determine separator: '+' for normal versions, '.' for dev versions with '+' + sep = "+" if "+" not in version else "." + + # Append device-specific suffix + device = detect_target_device() + + if device == "cuda": + version += f"{sep}cuda" + elif device == "rocm": + version += f"{sep}rocm" + elif device == "npu": + version += f"{sep}npu" + elif device == "xpu": + version += f"{sep}xpu" + elif device == "cpu": + version += f"{sep}cpu" + else: + raise RuntimeError(f"Unknown target device: {device}") + + return version + + def load_requirements(file_path: Path) -> list[str]: """ Load requirements from a file, supporting -r directive for recursive loading. @@ -167,5 +220,6 @@ def get_install_requires() -> list[str]: # Setup configuration setup( + version=get_vllm_omni_version(), install_requires=install_requires, ) diff --git a/vllm_omni/version.py b/vllm_omni/version.py index 15253fe6fd..e5f0b6b661 100644 --- a/vllm_omni/version.py +++ b/vllm_omni/version.py @@ -1,3 +1,25 @@ -__version__ = "0.14.0" -__version_tuple__ = (0, 14, 0) -# TODO: add auto version generation +""" +Version information for vLLM-Omni. + +The version is automatically generated from git tags via setuptools_scm +and written to _version.py during package build. +""" + +try: + # Import auto-generated version from _version.py (created by setuptools_scm) + from ._version import __version__, __version_tuple__ +except ImportError as e: + import warnings + + warnings.warn( + f"Failed to import version from _version.py: {e}\n" + "This typically happens in development mode before building.\n" + "Using fallback version 'dev'.", + RuntimeWarning, + stacklevel=2, + ) + + __version__ = "dev" + __version_tuple__ = (0, 0, "dev") + +__all__ = ["__version__", "__version_tuple__"] From 234d889b96bfce173f644bfd064342f2325c3bd1 Mon Sep 17 00:00:00 2001 From: tjtanaa Date: Thu, 5 Feb 2026 15:02:32 +0000 Subject: [PATCH 2/4] simplify Signed-off-by: tjtanaa --- setup.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 2f404b7108..638a1b4385 100644 --- a/setup.py +++ b/setup.py @@ -128,12 +128,7 @@ def get_vllm_omni_version() -> str: os.environ["SETUPTOOLS_SCM_PRETEND_VERSION"] = env_version return get_version(write_to="vllm_omni/_version.py") - # Generate version from git tags via setuptools_scm - try: - version = get_version(write_to="vllm_omni/_version.py") - except Exception as e: - print(f"Warning: Failed to get version from git, using fallback: {e}") - version = "dev" + version = get_version(write_to="vllm_omni/_version.py") # Determine separator: '+' for normal versions, '.' for dev versions with '+' sep = "+" if "+" not in version else "." From e43fec6f6c6899cbaa4433d3670fd70c92a7965f Mon Sep 17 00:00:00 2001 From: tjtanaa Date: Thu, 5 Feb 2026 15:09:36 +0000 Subject: [PATCH 3/4] add fallback if .git does not exists Signed-off-by: tjtanaa --- setup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 638a1b4385..7338b24325 100644 --- a/setup.py +++ b/setup.py @@ -128,7 +128,12 @@ def get_vllm_omni_version() -> str: os.environ["SETUPTOOLS_SCM_PRETEND_VERSION"] = env_version return get_version(write_to="vllm_omni/_version.py") - version = get_version(write_to="vllm_omni/_version.py") + # Generate version from git tags via setuptools_scm + try: + version = get_version(write_to="vllm_omni/_version.py") + except Exception as e: + print(f"Warning: Failed to get version from git, using fallback: {e}") + version = "dev" # Determine separator: '+' for normal versions, '.' for dev versions with '+' sep = "+" if "+" not in version else "." @@ -215,6 +220,5 @@ def get_install_requires() -> list[str]: # Setup configuration setup( - version=get_vllm_omni_version(), install_requires=install_requires, ) From 51e19f68d895d1ba1166ec073ad89039fcaf5406 Mon Sep 17 00:00:00 2001 From: tjtanaa Date: Thu, 5 Feb 2026 15:16:41 +0000 Subject: [PATCH 4/4] makesure vllm_omni.__version__ is consistent with pip list Signed-off-by: tjtanaa --- setup.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 7338b24325..496b032639 100644 --- a/setup.py +++ b/setup.py @@ -112,7 +112,7 @@ def get_vllm_omni_version() -> str: Version format: {base_version}+{device} Examples: - 0.14.0+cuda (release version with CUDA) - - 0.14.1.dev23+g1a2b3c4+rocm (dev version with ROCm) + - 0.14.1.dev23+g1a2b3c4.rocm (dev version with ROCm) - 0.15.0+npu (release version with NPU) Environment variables: @@ -126,14 +126,15 @@ def get_vllm_omni_version() -> str: if env_version := os.getenv("VLLM_OMNI_VERSION_OVERRIDE"): print(f"Overriding vLLM-Omni version with {env_version} from VLLM_OMNI_VERSION_OVERRIDE") os.environ["SETUPTOOLS_SCM_PRETEND_VERSION"] = env_version - return get_version(write_to="vllm_omni/_version.py") - - # Generate version from git tags via setuptools_scm - try: - version = get_version(write_to="vllm_omni/_version.py") - except Exception as e: - print(f"Warning: Failed to get version from git, using fallback: {e}") - version = "dev" + # Get version without device suffix for override case + version = get_version() + else: + # Generate version from git tags via setuptools_scm (without writing yet) + try: + version = get_version() + except Exception as e: + print(f"Warning: Failed to get version from git, using fallback: {e}") + version = "dev" # Determine separator: '+' for normal versions, '.' for dev versions with '+' sep = "+" if "+" not in version else "." @@ -154,6 +155,18 @@ def get_vllm_omni_version() -> str: else: raise RuntimeError(f"Unknown target device: {device}") + # Write the FULL version (with device suffix) to _version.py + # This ensures runtime import matches the package metadata version + version_file = Path(__file__).parent / "vllm_omni" / "_version.py" + version_file.parent.mkdir(parents=True, exist_ok=True) + + with open(version_file, "w") as f: + f.write(f"""# Automatically generated by setuptools_scm +__version__ = {version!r} +__version_tuple__ = tuple(__version__.split('.')) +""") + + print(f"Generated version: {version}") return version @@ -220,5 +233,6 @@ def get_install_requires() -> list[str]: # Setup configuration setup( + version=get_vllm_omni_version(), install_requires=install_requires, )