From 08faf16f81ae38e01030dc9db27aeddd5eb040c2 Mon Sep 17 00:00:00 2001 From: Alicia <115451386+congw729@users.noreply.github.com> Date: Mon, 24 Nov 2025 14:57:05 +0800 Subject: [PATCH] [CI] Add script for building wheel. (#75) Signed-off-by: WANG Cong <115451386+congw729@users.noreply.github.com> --- pyproject.toml | 8 ++- scripts/build_wheel.sh | 139 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+), 2 deletions(-) create mode 100755 scripts/build_wheel.sh diff --git a/pyproject.toml b/pyproject.toml index 95ab9111d..0d3c1de8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,10 +30,10 @@ classifiers = [ dependencies = [ # Core runtime dependencies (required for actual usage) "omegaconf>=2.3.0", - "decord>=0.6.0", + # "decord>=0.6.0", # install manually "librosa>=0.11.0", "resampy>=0.4.3", - # "vllm==0.11.0", # install manually + # "vllm==0.11.0", # TODO: fix the entrypoints overwrite problem ] [project.optional-dependencies] @@ -73,10 +73,14 @@ Documentation = "https://vllm-omni.readthedocs.io" vllm = "vllm_omni.entrypoints.cli.main:main" vllm-omni = "vllm_omni.entrypoints.cli.main:main" + [tool.setuptools.packages.find] where = ["."] include = ["vllm_omni*"] +[tool.setuptools.package-data] +"vllm_omni.model_executor.stage_configs" = ["*.yaml"] + [tool.ruff] line-length = 120 exclude = [ diff --git a/scripts/build_wheel.sh b/scripts/build_wheel.sh new file mode 100755 index 000000000..54769a307 --- /dev/null +++ b/scripts/build_wheel.sh @@ -0,0 +1,139 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)" +PROJECT_NAME="vllm-omni" +RUN_QUALITY=false +SKIP_CLEAN=false +CREATE_VENV=false +VENV_DIR=".venv-build" +PYTHON_BIN="python" +UV_BIN="uv" + +log() { + local level="$1" + shift + printf '[%s] %s\n' "${level}" "$*" +} + +abort() { + log "ERROR" "$*" + exit 1 +} + +usage() { + cat </dev/null 2>&1; then + log "INFO" "uv not found, installing via ${HOST_PYTHON}" + "${HOST_PYTHON}" -m pip install --upgrade pip + "${HOST_PYTHON}" -m pip install uv + fi +} + +ensure_uv + +if [[ "${CREATE_VENV}" == "true" ]]; then + log "INFO" "Creating fresh virtual environment at ${VENV_DIR} via uv" + "${UV_BIN}" venv --python "${HOST_PYTHON}" --seed "${VENV_DIR}" + PYTHON_BIN="${VENV_DIR}/bin/python" + [[ -x "${PYTHON_BIN}" ]] || abort "Failed to locate python inside ${VENV_DIR}" + log "INFO" "Installing build module inside virtual environment" + "${UV_BIN}" pip install --python "${PYTHON_BIN}" build +else + log "INFO" "Ensuring build module is available via uv pip" + "${UV_BIN}" pip install --python "${PYTHON_BIN}" build +fi + +log "INFO" "Checking build module" +if ! "${PYTHON_BIN}" -m build --version >/dev/null 2>&1; then + abort "${PYTHON_BIN} -m build is not available, install build first" +fi + +run_quality_steps() { + log "INFO" "Running quality checks" + "${UV_BIN}" pip install --python "${PYTHON_BIN}" -e ".[dev]" + "${PYTHON_BIN}" -m pre_commit run --all-files + "${PYTHON_BIN}" -m pytest tests/ -v -m "not slow" +} + +if [[ "${RUN_QUALITY}" == "true" ]]; then + run_quality_steps +else + log "INFO" "Quality steps available via --run-quality" + log "INFO" " - pre-commit run --all-files" + log "INFO" " - pip install -e '.[dev]'" + log "INFO" " - pytest tests/ -v -m \"not slow\"" +fi + +cleanup_artifacts() { + log "INFO" "Cleaning previous build artifacts" + rm -rf build dist "${PROJECT_NAME}.egg-info" "${PROJECT_NAME//-/_}.egg-info" +} + +if [[ "${SKIP_CLEAN}" == "true" ]]; then + log "INFO" "Skipping cleanup as requested" +else + cleanup_artifacts +fi + +log "INFO" "Building source and wheel distributions" +"${PYTHON_BIN}" -m build + +log "INFO" "Build finished, artifacts:" +ls -lh dist