[Build] Propagate vLLM version to Rust binaries (#52593)
Signed-off-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
co-authored by
Nick Hill
Andreas Karatzas
parent
b0e9cff5e7
commit
c89d692cb5
@@ -23,8 +23,8 @@ DEFAULT_CI_BASE_METADATA_VERSION="3"
|
||||
# local-source stages rather than unreachable remote-fetch alternatives.
|
||||
DEFAULT_ROCM_CSRC_CONTENT_FILES=".dockerignore requirements/common.txt requirements/rocm.txt pyproject.toml setup.py CMakeLists.txt cmake csrc vllm/envs.py vllm/__init__.py tools/build_rust.py"
|
||||
DEFAULT_ROCM_CSRC_DOCKERFILE_STAGES="base fetch_vllm_0 fetch_vllm build_vllm_dependencies rocm-triton-kernels csrc-build"
|
||||
DEFAULT_ROCM_RUST_CONTENT_FILES=".dockerignore requirements/build/rust.txt rust/Cargo.lock rust/Cargo.toml rust/proto rust/src rust-toolchain.toml tools/build_rust.py tools/install_protoc.sh build_rust.sh"
|
||||
DEFAULT_ROCM_RUST_DOCKERFILE_STAGES="base rust_toolchain_input_0 rust-toolchain-input rust_input_0 rust-input rust-toolchain rust-build"
|
||||
DEFAULT_ROCM_RUST_CONTENT_FILES=".dockerignore .git_archival.txt pyproject.toml requirements/build/rust.txt rust/Cargo.lock rust/Cargo.toml rust/proto rust/src rust-toolchain.toml tools/build_rust.py tools/install_protoc.sh build_rust.sh"
|
||||
DEFAULT_ROCM_RUST_DOCKERFILE_STAGES="base fetch_vllm_0 fetch_vllm vllm-version rust_toolchain_input_0 rust-toolchain-input rust_input_0 rust-input rust-toolchain rust-build"
|
||||
# Docker's 128-character tag limit minus the longest cache prefix
|
||||
# ("csrc-rocm-branch-" and "rust-rocm-branch-", both 17 characters).
|
||||
ROCM_CACHE_BRANCH_TAG_MAX_LEN=111
|
||||
@@ -523,8 +523,8 @@ prepare_ci_build_context() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# setuptools-scm understands Git's stable archive format, so full-source
|
||||
# wheels retain their exact version without copying mutable Git history.
|
||||
# setuptools-scm understands Git's stable archive format, so wheels and
|
||||
# Rust artifacts retain their exact version without copying Git history.
|
||||
if ! is_ci_base_target; then
|
||||
write_ci_git_archival_metadata "${source_root}" "${context_root}" \
|
||||
|| return $?
|
||||
|
||||
@@ -2356,7 +2356,7 @@ steps:
|
||||
- export VLLM_USE_RUST_FRONTEND=1
|
||||
- export VLLM_WORKER_MULTIPROC_METHOD=spawn
|
||||
- PYTHONPATH=/vllm-workspace pytest -v -s entrypoints/serve/dev/rpc/test_collective_rpc.py
|
||||
- pytest -v -s entrypoints/serve/instrumentator/test_basic.py -k "not show_version and not server_load"
|
||||
- pytest -v -s entrypoints/serve/instrumentator/test_basic.py -k "not server_load"
|
||||
- pytest -v -s entrypoints/scale_out/token_in_token_out/test_serving_tokens.py -k "not stream and not lora and not test_generate_logprobs and not stop_string_workflow"
|
||||
- pytest -v -s entrypoints/serve/instrumentator/test_metrics.py -k "text and not show and not run_batch and not test_metrics_counts and not test_metrics_exist"
|
||||
- pytest -v -s entrypoints/serve/tokenize/test_tokenization.py -k "not tokenizer_info"
|
||||
|
||||
@@ -58,7 +58,7 @@ steps:
|
||||
- export VLLM_WORKER_MULTIPROC_METHOD=spawn
|
||||
- PYTHONPATH=/vllm-workspace pytest -v -s entrypoints/serve/dev/rpc/test_collective_rpc.py
|
||||
# server_load can be flaky under the Rust frontend; keep it excluded for now.
|
||||
- pytest -v -s entrypoints/serve/instrumentator/test_basic.py -k "not show_version and not server_load"
|
||||
- pytest -v -s entrypoints/serve/instrumentator/test_basic.py -k "not server_load"
|
||||
# test_generate_logprobs expects Python-style top_logprobs truncation (dedup sampled + cap at max(k, 1)).
|
||||
- pytest -v -s entrypoints/scale_out/token_in_token_out/test_serving_tokens.py -k "not stream and not lora and not test_generate_logprobs and not stop_string_workflow"
|
||||
- pytest -v -s entrypoints/serve/instrumentator/test_metrics.py -k "text and not show and not run_batch and not test_metrics_counts and not test_metrics_exist"
|
||||
|
||||
@@ -279,11 +279,16 @@ ENV CARGO_BUILD_JOBS=4
|
||||
# separate local sccache daemon while sharing the same remote cache backend.
|
||||
ENV SCCACHE_SERVER_PORT=4227
|
||||
|
||||
# Only Rust inputs are present, so suppress the artificial dirty state caused
|
||||
# by other tracked files being absent from this build stage.
|
||||
ENV SETUPTOOLS_SCM_PRETEND_METADATA={dirty=false}
|
||||
|
||||
# Build the release artifacts. Cache cargo registry/git, but not target/,
|
||||
# because stale target metadata can outlive source updates across BuildKit
|
||||
# cache reuse.
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cargo/git,sharing=locked \
|
||||
--mount=type=bind,source=.git,target=.git \
|
||||
--mount=type=secret,id=aws-credentials,target=/root/.aws/credentials,required=false \
|
||||
if [ "$USE_SCCACHE" = "1" ]; then \
|
||||
if [ -n "${SCCACHE_ENDPOINT}" ]; then export SCCACHE_ENDPOINT="${SCCACHE_ENDPOINT}"; fi; \
|
||||
|
||||
@@ -166,11 +166,16 @@ COPY build_rust.sh build_rust.sh
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
ENV CARGO_BUILD_JOBS=4
|
||||
|
||||
# Only Rust inputs are present, so suppress the artificial dirty state caused
|
||||
# by other tracked files being absent from this build stage.
|
||||
ENV SETUPTOOLS_SCM_PRETEND_METADATA={dirty=false}
|
||||
|
||||
# Build the release artifacts. Cache cargo registry/git, but not target/,
|
||||
# because stale target metadata can outlive source updates across BuildKit
|
||||
# cache reuse.
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cargo/git,sharing=locked \
|
||||
--mount=type=bind,source=.git,target=.git \
|
||||
--mount=type=secret,id=aws-credentials,target=/root/.aws/credentials,required=false \
|
||||
if [ "$USE_SCCACHE" = "1" ]; then \
|
||||
export RUSTC_WRAPPER=sccache; \
|
||||
|
||||
+23
-12
@@ -125,6 +125,18 @@ ONBUILD RUN git clone ${VLLM_REPO} \
|
||||
&& git fetch upstream ; fi
|
||||
FROM fetch_vllm_${REMOTE_VLLM} AS fetch_vllm
|
||||
|
||||
# Resolve the device-independent source version once for every downstream
|
||||
# artifact. setuptools-scm reads Git metadata for local/remote sources and the
|
||||
# archive metadata generated for canonical CI contexts.
|
||||
FROM fetch_vllm AS vllm-version
|
||||
ARG COMMON_WORKDIR
|
||||
RUN --mount=type=cache,id=vllm-rocm-uv,target=/root/.cache/uv \
|
||||
cd ${COMMON_WORKDIR}/vllm \
|
||||
&& uv pip install --system -r requirements/build/rust.txt \
|
||||
&& python3 -c \
|
||||
"from setuptools_scm import get_version; print(get_version())" \
|
||||
> /vllm-version.txt
|
||||
|
||||
# -----------------------
|
||||
# Rust/protoc toolchain inputs
|
||||
#
|
||||
@@ -238,6 +250,7 @@ COPY --from=rust-input /rust-input/vllm/rust rust
|
||||
COPY --from=rust-input /rust-input/vllm/rust-toolchain.toml rust-toolchain.toml
|
||||
COPY --from=rust-input /rust-input/vllm/tools/build_rust.py tools/build_rust.py
|
||||
COPY --from=rust-input /rust-input/vllm/build_rust.sh build_rust.sh
|
||||
COPY --from=vllm-version /vllm-version.txt /tmp/vllm-version.txt
|
||||
|
||||
# Build the release binary. Cargo's registry/git caches can be written by
|
||||
# concurrent BuildKit jobs on shared workers, so lock those cache mounts while
|
||||
@@ -249,6 +262,7 @@ RUN --mount=type=cache,id=vllm-rocm-cargo-registry,target=/root/.cargo/registry,
|
||||
export RUSTC_WRAPPER=sccache \
|
||||
&& sccache --show-stats; \
|
||||
fi \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& bash build_rust.sh \
|
||||
&& test -x vllm/vllm-rs \
|
||||
&& if [ "$USE_SCCACHE" = "1" ]; then \
|
||||
@@ -334,6 +348,7 @@ RUN --mount=type=bind,source=pyproject.toml,target=${COMMON_WORKDIR}/vllm/pyproj
|
||||
FROM build_vllm_dependencies AS build_vllm
|
||||
COPY --from=fetch_vllm ${COMMON_WORKDIR}/vllm ${COMMON_WORKDIR}/vllm
|
||||
COPY --from=csrc-build ${COMMON_WORKDIR}/vllm/dist /precompiled-wheels
|
||||
COPY --from=vllm-version /vllm-version.txt /tmp/vllm-version.txt
|
||||
|
||||
# Drop the pre-built Rust artifacts into the source tree. setup.py detects
|
||||
# them and ships them as-is, skipping the local Rust build.
|
||||
@@ -341,6 +356,7 @@ COPY --from=rust-build ${COMMON_WORKDIR}/vllm/vllm/vllm-rs ${COMMON_WORKDIR}/vll
|
||||
COPY --from=rust-build ${COMMON_WORKDIR}/vllm/vllm/_rust_*.so ${COMMON_WORKDIR}/vllm/vllm/
|
||||
|
||||
RUN cd "${COMMON_WORKDIR}/vllm" \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& export VLLM_USE_PRECOMPILED=1 \
|
||||
&& export VLLM_PRECOMPILED_WHEEL_LOCATION="$(ls /precompiled-wheels/*.whl)" \
|
||||
&& export VLLM_DOCKER_BUILD_CONTEXT=1 \
|
||||
@@ -640,6 +656,7 @@ FROM fetch_vllm AS build_vllm_wheel_release
|
||||
|
||||
ARG COMMON_WORKDIR
|
||||
ARG ROCM_TRITON_KERNELS_COMMIT
|
||||
COPY --from=vllm-version /vllm-version.txt /tmp/vllm-version.txt
|
||||
COPY --from=rocm-triton-kernels \
|
||||
/opt/rocm-triton-kernels /opt/rocm-triton-kernels
|
||||
ENV TRITON_KERNELS_SRC_DIR=/opt/rocm-triton-kernels
|
||||
@@ -678,17 +695,12 @@ RUN if [ "$GIT_REPO_CHECK" != "0" ]; then \
|
||||
cd vllm && bash tools/check_repo.sh; \
|
||||
fi
|
||||
|
||||
# Extract version from git BEFORE any modifications (pin_rocm_dependencies.py modifies requirements/rocm.txt)
|
||||
# This ensures setuptools_scm sees clean repo state for version detection
|
||||
RUN --mount=type=bind,source=.git,target=vllm/.git \
|
||||
--mount=type=cache,target=/root/.cache/uv \
|
||||
# Install the packaging helpers before modifying requirements/rocm.txt.
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
grep -Fq "set(TRITON_KERNELS_TAG \"${ROCM_TRITON_KERNELS_COMMIT}\")" \
|
||||
vllm/cmake/external_projects/triton_kernels.cmake \
|
||||
&& cd vllm \
|
||||
&& uv pip install --system setuptools_scm regex \
|
||||
&& VLLM_VERSION=$(python3 -c "import setuptools_scm; print(setuptools_scm.get_version())") \
|
||||
&& echo "Detected vLLM version: ${VLLM_VERSION}" \
|
||||
&& echo "${VLLM_VERSION}" > /tmp/vllm_version.txt
|
||||
&& uv pip install --system setuptools_scm regex
|
||||
|
||||
# Fail if git-based package dependencies are found in requirements files
|
||||
# (uv doesn't handle git+ URLs well, and packages should be distributed on PyPI)
|
||||
@@ -726,13 +738,12 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
&& echo "Building vLLM with custom wheels from /install" \
|
||||
&& uv pip install --system --find-links /install -r requirements/rocm.txt
|
||||
|
||||
# Build wheel using pre-extracted version to avoid dirty state from modified requirements/rocm.txt
|
||||
# Build wheel using the shared source version to avoid dirty state from modified requirements/rocm.txt
|
||||
# (setup.py auto-detects ccache/sccache in PATH)
|
||||
RUN --mount=type=bind,source=.git,target=vllm/.git \
|
||||
--mount=type=cache,id=vllm-rocm-ccache,target=/root/.cache/ccache \
|
||||
RUN --mount=type=cache,id=vllm-rocm-ccache,target=/root/.cache/ccache \
|
||||
cd vllm \
|
||||
&& export CCACHE_BASEDIR="$PWD" \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION=$(cat /tmp/vllm_version.txt) \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& echo "Building wheel with version: ${SETUPTOOLS_SCM_PRETEND_VERSION}" \
|
||||
&& MAX_JOBS="${MAX_JOBS:-$(nproc)}" python3 setup.py bdist_wheel --dist-dir=dist
|
||||
|
||||
|
||||
@@ -127,6 +127,17 @@ ONBUILD RUN git clone ${VLLM_REPO} \
|
||||
&& git fetch upstream ; fi
|
||||
FROM fetch_vllm_${REMOTE_VLLM} AS fetch_vllm
|
||||
|
||||
# Resolve the device-independent source version once for every downstream
|
||||
# artifact. setuptools-scm reads Git metadata from local and remote sources.
|
||||
FROM fetch_vllm AS vllm-version
|
||||
ARG COMMON_WORKDIR
|
||||
RUN --mount=type=cache,id=vllm-rocm-uv,target=/root/.cache/uv \
|
||||
cd ${COMMON_WORKDIR}/vllm \
|
||||
&& uv pip install --system -r requirements/build/rust.txt \
|
||||
&& python3 -c \
|
||||
"from setuptools_scm import get_version; print(get_version())" \
|
||||
> /vllm-version.txt
|
||||
|
||||
# -----------------------
|
||||
# Rust build stage
|
||||
# Builds the `vllm-rs` frontend in a dedicated stage so the wheel build stages
|
||||
@@ -152,6 +163,8 @@ RUN --mount=type=cache,id=vllm-rocm-uv,target=/root/.cache/uv \
|
||||
cd ${COMMON_WORKDIR}/vllm \
|
||||
&& uv pip install --system -r requirements/build/rust.txt
|
||||
|
||||
COPY --from=vllm-version /vllm-version.txt /tmp/vllm-version.txt
|
||||
|
||||
# Build the release binary. Cargo's registry/git caches can be written by
|
||||
# concurrent BuildKit jobs on shared workers, so lock those cache mounts while
|
||||
# keeping the cache benefit. Do not cache target/, because stale target metadata
|
||||
@@ -159,6 +172,7 @@ RUN --mount=type=cache,id=vllm-rocm-uv,target=/root/.cache/uv \
|
||||
RUN --mount=type=cache,id=vllm-rocm-cargo-registry,target=/root/.cargo/registry,sharing=locked \
|
||||
--mount=type=cache,id=vllm-rocm-cargo-git,target=/root/.cargo/git,sharing=locked \
|
||||
cd ${COMMON_WORKDIR}/vllm \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& bash build_rust.sh \
|
||||
&& test -x vllm/vllm-rs
|
||||
|
||||
@@ -211,6 +225,7 @@ ARG COMMON_WORKDIR
|
||||
ENV VLLM_TARGET_DEVICE=rocm
|
||||
|
||||
COPY --from=csrc-build ${COMMON_WORKDIR}/vllm/dist /precompiled-wheels
|
||||
COPY --from=vllm-version /vllm-version.txt /tmp/vllm-version.txt
|
||||
|
||||
# Drop the pre-built Rust artifacts into the source tree. setup.py detects
|
||||
# them and ships them as-is, skipping the local Rust build.
|
||||
@@ -220,6 +235,7 @@ COPY --from=rust-build ${COMMON_WORKDIR}/vllm/vllm/_rust_*.so ${COMMON_WORKDIR}/
|
||||
RUN --mount=type=cache,id=vllm-rocm-uv,target=/root/.cache/uv \
|
||||
cd vllm \
|
||||
&& uv pip install --system -r requirements/rocm.txt \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& export VLLM_USE_PRECOMPILED=1 \
|
||||
&& export VLLM_PRECOMPILED_WHEEL_LOCATION="$(ls /precompiled-wheels/*.whl)" \
|
||||
&& export VLLM_DOCKER_BUILD_CONTEXT=1 \
|
||||
@@ -426,6 +442,7 @@ RUN /bin/bash -lc 'set -euo pipefail; \
|
||||
FROM fetch_vllm AS build_vllm_wheel_release
|
||||
|
||||
ARG COMMON_WORKDIR
|
||||
COPY --from=vllm-version /vllm-version.txt /tmp/vllm-version.txt
|
||||
|
||||
# Drop the pre-built Rust artifacts into the source tree. setup.py detects
|
||||
# them and ships them as-is, skipping the local Rust build.
|
||||
@@ -461,15 +478,10 @@ RUN if [ "$GIT_REPO_CHECK" != "0" ]; then \
|
||||
cd vllm && bash tools/check_repo.sh; \
|
||||
fi
|
||||
|
||||
# Extract version from git BEFORE any modifications (pin_rocm_dependencies.py modifies requirements/rocm.txt)
|
||||
# This ensures setuptools_scm sees clean repo state for version detection
|
||||
RUN --mount=type=bind,source=.git,target=vllm/.git \
|
||||
--mount=type=cache,target=/root/.cache/uv \
|
||||
# Install the packaging helpers before modifying requirements/rocm.txt.
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
cd vllm \
|
||||
&& uv pip install --system setuptools_scm regex \
|
||||
&& VLLM_VERSION=$(python3 -c "import setuptools_scm; print(setuptools_scm.get_version())") \
|
||||
&& echo "Detected vLLM version: ${VLLM_VERSION}" \
|
||||
&& echo "${VLLM_VERSION}" > /tmp/vllm_version.txt
|
||||
&& uv pip install --system setuptools_scm regex
|
||||
|
||||
# Fail if git-based package dependencies are found in requirements files
|
||||
# (uv doesn't handle git+ URLs well, and packages should be distributed on PyPI)
|
||||
@@ -507,13 +519,12 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
&& echo "Building vLLM with custom wheels from /install" \
|
||||
&& uv pip install --system --find-links /install -r requirements/rocm.txt
|
||||
|
||||
# Build wheel using pre-extracted version to avoid dirty state from modified requirements/rocm.txt
|
||||
# Build wheel using the shared source version to avoid dirty state from modified requirements/rocm.txt
|
||||
# (setup.py auto-detects ccache/sccache in PATH)
|
||||
RUN --mount=type=bind,source=.git,target=vllm/.git \
|
||||
--mount=type=cache,id=vllm-rocm-ccache,target=/root/.cache/ccache \
|
||||
RUN --mount=type=cache,id=vllm-rocm-ccache,target=/root/.cache/ccache \
|
||||
cd vllm \
|
||||
&& export CCACHE_BASEDIR="$PWD" \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION=$(cat /tmp/vllm_version.txt) \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& echo "Building wheel with version: ${SETUPTOOLS_SCM_PRETEND_VERSION}" \
|
||||
&& MAX_JOBS="${MAX_JOBS:-$(nproc)}" python3 setup.py bdist_wheel --dist-dir=dist
|
||||
|
||||
|
||||
@@ -28,8 +28,13 @@ COPY build_rust.sh build_rust.sh
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
ENV CARGO_BUILD_JOBS=4
|
||||
|
||||
# Only Rust inputs are present, so suppress the artificial dirty state caused
|
||||
# by other tracked files being absent from this build stage.
|
||||
ENV SETUPTOOLS_SCM_PRETEND_METADATA={dirty=false}
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cargo/git,sharing=locked \
|
||||
--mount=type=bind,source=.git,target=.git \
|
||||
bash build_rust.sh
|
||||
|
||||
FROM ubuntu:24.04 AS vllm-base
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Dependencies for building Rust artifacts through setuptools-rust.
|
||||
setuptools>=77.0.3,<81.0.0
|
||||
setuptools-scm>=9.2.0
|
||||
setuptools-rust>=1.9.0
|
||||
wheel
|
||||
|
||||
Generated
+7
@@ -5505,9 +5505,14 @@ dependencies = [
|
||||
"tracing",
|
||||
"url",
|
||||
"uuid",
|
||||
"vllm-build-info",
|
||||
"vllm-tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vllm-build-info"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "vllm-chat"
|
||||
version = "0.1.0"
|
||||
@@ -5574,6 +5579,7 @@ dependencies = [
|
||||
"tracing",
|
||||
"uuid",
|
||||
"vllm-bench",
|
||||
"vllm-build-info",
|
||||
"vllm-chat",
|
||||
"vllm-engine-core-client",
|
||||
"vllm-managed-engine",
|
||||
@@ -5755,6 +5761,7 @@ dependencies = [
|
||||
"url",
|
||||
"uuid",
|
||||
"validator",
|
||||
"vllm-build-info",
|
||||
"vllm-chat",
|
||||
"vllm-engine-core-client",
|
||||
"vllm-llm",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"src/bench",
|
||||
"src/build-info",
|
||||
"src/chat",
|
||||
"src/cmd",
|
||||
"src/engine-core-client",
|
||||
@@ -135,6 +136,7 @@ url = "2.5.7"
|
||||
uuid = { version = "1.22.0", features = ["v4"] }
|
||||
validator = { version = "0.20.0", features = ["derive"] }
|
||||
vllm-bench = { path = "src/bench" }
|
||||
vllm-build-info = { path = "src/build-info" }
|
||||
vllm-chat = { path = "src/chat" }
|
||||
vllm-engine-core-client = { path = "src/engine-core-client" }
|
||||
vllm-llm = { path = "src/llm" }
|
||||
|
||||
@@ -34,6 +34,7 @@ tokio-stream.workspace = true
|
||||
tracing.workspace = true
|
||||
url.workspace = true
|
||||
uuid.workspace = true
|
||||
vllm-build-info.workspace = true
|
||||
vllm-tracing.workspace = true
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -12,7 +12,7 @@ use clap::Parser;
|
||||
#[command(
|
||||
name = "vllm-bench",
|
||||
about = "Benchmark online serving throughput",
|
||||
version
|
||||
version = vllm_build_info::VERSION
|
||||
)]
|
||||
struct Cli {
|
||||
#[command(flatten)]
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "vllm-build-info"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
/// The vLLM package version supplied by the build system.
|
||||
///
|
||||
/// Direct Cargo builds fall back to the internal crate version.
|
||||
pub const VERSION: &str = match option_env!("VLLM_RS_BUILD_VERSION") {
|
||||
Some(version) => version,
|
||||
None => env!("CARGO_PKG_VERSION"),
|
||||
};
|
||||
@@ -28,6 +28,7 @@ tokio-util.workspace = true
|
||||
tracing.workspace = true
|
||||
uuid.workspace = true
|
||||
vllm-bench.workspace = true
|
||||
vllm-build-info.workspace = true
|
||||
vllm-chat.workspace = true
|
||||
vllm-engine-core-client.workspace = true
|
||||
vllm-managed-engine.workspace = true
|
||||
|
||||
@@ -39,7 +39,8 @@ use crate::cli::unsupported::UnsupportedArgs;
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(
|
||||
name = "vllm-rs",
|
||||
about = "Rust frontend and managed-engine CLI for vLLM."
|
||||
about = "Rust frontend and managed-engine CLI for vLLM.",
|
||||
version = vllm_build_info::VERSION
|
||||
)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
|
||||
@@ -45,6 +45,7 @@ tracing-subscriber.workspace = true
|
||||
url.workspace = true
|
||||
uuid.workspace = true
|
||||
validator.workspace = true
|
||||
vllm-build-info.workspace = true
|
||||
vllm-chat.workspace = true
|
||||
vllm-engine-core-client.workspace = true
|
||||
vllm-llm.workspace = true
|
||||
|
||||
@@ -1746,7 +1746,7 @@ async fn version_returns_engine_vllm_version() {
|
||||
json,
|
||||
json!({
|
||||
"version": "test-vllm-version",
|
||||
"rust_frontend_version": env!("CARGO_PKG_VERSION"),
|
||||
"rust_frontend_version": vllm_build_info::VERSION,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ pub async fn version(State(state): State<Arc<AppState>>) -> Json<VersionResponse
|
||||
|
||||
Json(VersionResponse {
|
||||
version,
|
||||
rust_frontend_version: env!("CARGO_PKG_VERSION"),
|
||||
rust_frontend_version: vllm_build_info::VERSION,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1493,6 +1493,11 @@ if (
|
||||
):
|
||||
cmdclass["build_rust"] = precompiled_build_rust
|
||||
|
||||
# Resolve the Python version first because get_vllm_version() may set
|
||||
# SETUPTOOLS_SCM_PRETEND_VERSION, which the Rust version should inherit.
|
||||
vllm_version = get_vllm_version()
|
||||
rust_build.prepare_build_environment()
|
||||
|
||||
# Rust artifacts, built via setuptools-rust and installed into the package
|
||||
# directory alongside the Python modules.
|
||||
rust_extensions = rust_build.rust_extensions(
|
||||
@@ -1501,7 +1506,7 @@ rust_extensions = rust_build.rust_extensions(
|
||||
|
||||
setup(
|
||||
# static metadata should rather go in pyproject.toml
|
||||
version=get_vllm_version(),
|
||||
version=vllm_version,
|
||||
ext_modules=ext_modules,
|
||||
rust_extensions=rust_extensions,
|
||||
install_requires=get_requirements(),
|
||||
|
||||
@@ -6,6 +6,7 @@ from tempfile import TemporaryDirectory
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from vllm import envs
|
||||
from vllm.version import __version__ as VLLM_VERSION
|
||||
|
||||
from ...utils import RemoteOpenAIServer
|
||||
@@ -40,5 +41,7 @@ async def test_show_version(server: RemoteOpenAIServer):
|
||||
response = client.get(server.url_for("version"))
|
||||
response.raise_for_status()
|
||||
|
||||
# Tolerate additive fields (e.g. the Rust frontend reports its own version).
|
||||
assert response.json()["version"] == VLLM_VERSION
|
||||
payload = response.json()
|
||||
assert payload["version"] == VLLM_VERSION
|
||||
if envs.VLLM_USE_RUST_FRONTEND:
|
||||
assert payload["rust_frontend_version"] == VLLM_VERSION
|
||||
|
||||
@@ -12,6 +12,7 @@ import requests
|
||||
from fastapi import Request
|
||||
|
||||
from tests.utils import RemoteOpenAIServer
|
||||
from vllm import envs
|
||||
from vllm.v1.engine.exceptions import EngineDeadError
|
||||
from vllm.version import __version__ as VLLM_VERSION
|
||||
|
||||
@@ -83,8 +84,10 @@ async def test_show_version(server: RemoteOpenAIServer):
|
||||
response = requests.get(server.url_for("version"))
|
||||
response.raise_for_status()
|
||||
|
||||
# Tolerate additive fields (e.g. the Rust frontend reports its own version).
|
||||
assert response.json()["version"] == VLLM_VERSION
|
||||
payload = response.json()
|
||||
assert payload["version"] == VLLM_VERSION
|
||||
if envs.VLLM_USE_RUST_FRONTEND:
|
||||
assert payload["rust_frontend_version"] == VLLM_VERSION
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -11,8 +11,23 @@ from pathlib import Path
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools_rust import Binding, RustExtension
|
||||
from setuptools_scm import get_version
|
||||
|
||||
ROOT_DIR = Path(__file__).resolve().parents[1]
|
||||
VLLM_RS_BUILD_VERSION = "VLLM_RS_BUILD_VERSION"
|
||||
|
||||
|
||||
def prepare_build_environment() -> str | None:
|
||||
"""Set the device-independent vLLM source version for Rust artifacts."""
|
||||
version = os.getenv(VLLM_RS_BUILD_VERSION) or None
|
||||
if version is None:
|
||||
try:
|
||||
version = get_version(root=ROOT_DIR)
|
||||
except LookupError:
|
||||
return None
|
||||
|
||||
os.environ[VLLM_RS_BUILD_VERSION] = version
|
||||
return version
|
||||
|
||||
|
||||
def rust_extensions(*, optional: bool = False) -> list[RustExtension]:
|
||||
@@ -61,6 +76,7 @@ def build_binary(build_rust_args: list[str]) -> None:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
prepare_build_environment()
|
||||
build_binary(sys.argv[1:])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user