[Version] Auto generate version using setuptool_scm (#1224)
Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
This commit is contained in:
1 parent
aa54569033
commit
7ac8d613f6
7 files changed
+97
-8
No files matched your search
@@ -3,7 +3,7 @@ steps:
|
|||||||
key: image-build
|
key: image-build
|
||||||
commands:
|
commands:
|
||||||
- "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7"
|
- "aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/q9t5s3a7"
|
||||||
- "docker build --file docker/Dockerfile.ci -t vllm-omni-ci ."
|
- "docker build --progress=plain --file docker/Dockerfile.ci -t vllm-omni-ci ."
|
||||||
- "docker tag vllm-omni-ci public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT"
|
- "docker tag vllm-omni-ci public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT"
|
||||||
- "docker push public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT"
|
- "docker push public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:$BUILDKITE_COMMIT"
|
||||||
agents:
|
agents:
|
||||||
|
|||||||
@@ -243,5 +243,7 @@ Dockerfile.dev
|
|||||||
discussion
|
discussion
|
||||||
tmp_test
|
tmp_test
|
||||||
|
|
||||||
|
# Auto-generated version file (created by setuptools_scm during build)
|
||||||
|
vllm_omni/_version.py
|
||||||
# output files
|
# output files
|
||||||
*.wav
|
*.wav
|
||||||
@@ -8,7 +8,7 @@ COPY . .
|
|||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y ffmpeg sox libsox-fmt-all jq && \
|
apt-get install -y ffmpeg git sox libsox-fmt-all jq && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ WORKDIR ${COMMON_WORKDIR}
|
|||||||
|
|
||||||
# Step 1: Setup - Install system dependencies
|
# Step 1: Setup - Install system dependencies
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y ffmpeg && \
|
apt-get install -y ffmpeg git sox libsox-fmt-all jq && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "vllm-omni"
|
name = "vllm-omni"
|
||||||
version = "0.14.0"
|
dynamic = ["version", "dependencies"]
|
||||||
description = "A framework for efficient model inference with omni-modality models"
|
description = "A framework for efficient model inference with omni-modality models"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10,<3.14"
|
requires-python = ">=3.10,<3.14"
|
||||||
@@ -17,7 +17,6 @@ authors = [
|
|||||||
{name = "vLLM-Omni Team"}
|
{name = "vLLM-Omni Team"}
|
||||||
]
|
]
|
||||||
keywords = ["vllm", "multimodal", "diffusion", "transformer", "inference", "serving"]
|
keywords = ["vllm", "multimodal", "diffusion", "transformer", "inference", "serving"]
|
||||||
dynamic = ["dependencies"]
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 3 - Alpha",
|
"Development Status :: 3 - Alpha",
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
@@ -85,8 +84,12 @@ where = ["."]
|
|||||||
include = ["vllm_omni*"]
|
include = ["vllm_omni*"]
|
||||||
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
|
"vllm_omni" = ["_version.py", "py.typed"]
|
||||||
"vllm_omni.model_executor.stage_configs" = ["*.yaml"]
|
"vllm_omni.model_executor.stage_configs" = ["*.yaml"]
|
||||||
|
|
||||||
|
[tool.setuptools_scm]
|
||||||
|
# no extra settings needed, presence enables setuptools-scm
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
exclude = [
|
exclude = [
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
from setuptools_scm import get_version
|
||||||
|
|
||||||
|
|
||||||
def uninstall_onnxruntime() -> None:
|
def uninstall_onnxruntime() -> None:
|
||||||
@@ -104,6 +105,66 @@ def detect_target_device() -> str:
|
|||||||
return "cuda"
|
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
|
||||||
|
# Get version without device suffix for override case
|
||||||
|
version = get_version(write_to="vllm_omni/_version.py")
|
||||||
|
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 "."
|
||||||
|
|
||||||
|
# Append device-specific suffix
|
||||||
|
device = detect_target_device()
|
||||||
|
|
||||||
|
if device == "cuda":
|
||||||
|
# if it is cuda, following vLLM
|
||||||
|
# we don't need to add any suffix
|
||||||
|
pass
|
||||||
|
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}")
|
||||||
|
|
||||||
|
# Tell setuptools_scm to use this version
|
||||||
|
# This will be picked up by write_to and written to _version.py
|
||||||
|
os.environ["SETUPTOOLS_SCM_PRETEND_VERSION"] = version
|
||||||
|
get_version(write_to="vllm_omni/_version.py") # Write the correct version
|
||||||
|
print(f"Generated version: {version}")
|
||||||
|
return version
|
||||||
|
|
||||||
|
|
||||||
def load_requirements(file_path: Path) -> list[str]:
|
def load_requirements(file_path: Path) -> list[str]:
|
||||||
"""
|
"""
|
||||||
Load requirements from a file, supporting -r directive for recursive loading.
|
Load requirements from a file, supporting -r directive for recursive loading.
|
||||||
@@ -167,5 +228,6 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Setup configuration
|
# Setup configuration
|
||||||
setup(
|
setup(
|
||||||
|
version=get_vllm_omni_version(),
|
||||||
install_requires=install_requires,
|
install_requires=install_requires,
|
||||||
)
|
)
|
||||||
+25
-3
@@ -1,3 +1,25 @@
|
|||||||
__version__ = "0.14.0"
|
"""
|
||||||
__version_tuple__ = (0, 14, 0)
|
Version information for vLLM-Omni.
|
||||||
# TODO: add auto version generation
|
|
||||||
|
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__"]
|
||||||
Reference in new issue
Block a user