Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ dependencies = [
# Distributed computing
"ray[default]",
"redis",
"awex==0.5.0",
"awex==0.7.0",

# Web frameworks
"fastapi>=0.115.12",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.vllm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ dependencies = [
# Distributed computing
"ray[default]",
"redis",
"awex==0.5.0",
"awex==0.7.0",

# Web frameworks
"fastapi>=0.115.12",
Expand Down
49 changes: 49 additions & 0 deletions scripts/uv_lock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"

DEFAULT_PYPROJECT="${REPO_ROOT}/pyproject.toml"
VLLM_PYPROJECT="${REPO_ROOT}/pyproject.vllm.toml"
DEFAULT_LOCK="${REPO_ROOT}/uv.lock"
VLLM_LOCK="${REPO_ROOT}/uv.vllm.lock"

if ! command -v uv >/dev/null 2>&1; then
echo "[AReaL] Error: 'uv' is not installed or not in PATH." >&2
exit 1
fi

if [[ ! -f "${DEFAULT_PYPROJECT}" || ! -f "${VLLM_PYPROJECT}" ]]; then
echo "[AReaL] Error: pyproject.toml and pyproject.vllm.toml must both exist." >&2
exit 1
fi

TMP_DIR="$(mktemp -d)"
cleanup() {
if [[ -f "${TMP_DIR}/pyproject.toml.bak" ]]; then
cp "${TMP_DIR}/pyproject.toml.bak" "${DEFAULT_PYPROJECT}"
fi
if [[ -f "${TMP_DIR}/uv.lock.bak" ]]; then
cp "${TMP_DIR}/uv.lock.bak" "${DEFAULT_LOCK}"
fi
rm -rf "${TMP_DIR}"
}
trap cleanup EXIT

cd "${REPO_ROOT}"

echo "[AReaL] Generating default lockfile from pyproject.toml..."
uv lock

cp "${DEFAULT_PYPROJECT}" "${TMP_DIR}/pyproject.toml.bak"
cp "${DEFAULT_LOCK}" "${TMP_DIR}/uv.lock.bak"

echo "[AReaL] Generating vLLM lockfile from pyproject.vllm.toml..."
cp "${VLLM_PYPROJECT}" "${DEFAULT_PYPROJECT}"
uv lock
cp "${DEFAULT_LOCK}" "${VLLM_LOCK}"

Comment on lines +22 to +46

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current approach of manually backing up and overwriting pyproject.toml is fragile and can leave the repository in an inconsistent state if the script is interrupted.

You can use the UV_PROJECT_FILE and UV_LOCKFILE environment variables to specify the manifest and lockfile paths directly. Additionally, using --upgrade-package awex ensures that only the intended dependency is updated, preventing unrelated noise (like the downgrades and unrelated upgrades seen in this PR) in the lockfiles.

Suggested change
TMP_DIR="$(mktemp -d)"
cleanup() {
if [[ -f "${TMP_DIR}/pyproject.toml.bak" ]]; then
cp "${TMP_DIR}/pyproject.toml.bak" "${DEFAULT_PYPROJECT}"
fi
if [[ -f "${TMP_DIR}/uv.lock.bak" ]]; then
cp "${TMP_DIR}/uv.lock.bak" "${DEFAULT_LOCK}"
fi
rm -rf "${TMP_DIR}"
}
trap cleanup EXIT
cd "${REPO_ROOT}"
echo "[AReaL] Generating default lockfile from pyproject.toml..."
uv lock
cp "${DEFAULT_PYPROJECT}" "${TMP_DIR}/pyproject.toml.bak"
cp "${DEFAULT_LOCK}" "${TMP_DIR}/uv.lock.bak"
echo "[AReaL] Generating vLLM lockfile from pyproject.vllm.toml..."
cp "${VLLM_PYPROJECT}" "${DEFAULT_PYPROJECT}"
uv lock
cp "${DEFAULT_LOCK}" "${VLLM_LOCK}"
cd "${REPO_ROOT}"
# Use environment variables to specify manifest and lockfile paths,
# avoiding the need to overwrite files or use temporary backups.
echo "[AReaL] Generating default lockfile..."
uv lock --upgrade-package awex
echo "[AReaL] Generating vLLM lockfile..."
UV_PROJECT_FILE="${VLLM_PYPROJECT}" UV_LOCKFILE="${VLLM_LOCK}" uv lock --upgrade-package awex

echo "[AReaL] Done. Updated files:"
echo " - uv.lock"
echo " - uv.vllm.lock"
Loading
Loading