Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI/Build] adopt uv #199

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 8 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
paths:
- '.github/workflows/**'
- '**.py'
- 'setup.py'
- 'pyproject.toml'
pull_request:
paths:
- '.github/workflows/**'
- '**.py'
- 'setup.py'
- 'pyproject.toml'
merge_group:

concurrency:
Expand All @@ -27,17 +27,14 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: '3.12.8'
enable-cache: true
ignore-nothing-to-cache: true

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r requirements-test.txt
run: uv sync --all-extras --all-groups

- name: Run Tests
run: |
pytest
run: uv run pytest
6 changes: 3 additions & 3 deletions .github/workflows/functionality-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
paths:
- '.github/**'
- '**.py'
- 'setup.py'
- 'pyproject.toml'
- 'helm/**'
pull_request:
paths:
- '.github/**'
- '**.py'
- 'setup.py'
- 'pyproject.toml'
- 'helm/**'
merge_group:
jobs:
Expand All @@ -32,7 +32,7 @@ jobs:
DOCKER_BUILDKIT: 1
run: |
cd ${{ github.workspace }}
sudo docker build --build-arg INSTALL_SENTENCE_TRANSFORMERS=false -t localhost:5000/git-act-router -f docker/Dockerfile .
sudo docker build --build-arg INSTALL_OPTIONAL_DEP=default -t localhost:5000/git-act-router -f docker/Dockerfile .
sudo docker push localhost:5000/git-act-router
sudo sysctl fs.protected_regular=0
sudo minikube image load localhost:5000/git-act-router
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/router-docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
paths:
- 'src/vllm_router/**'
- 'docker/**'
- 'setup.py'
- 'pyproject.toml'

workflow_dispatch:

Expand Down Expand Up @@ -45,7 +45,8 @@ jobs:
- name: Extract and sanitize version
id: version
run: |
raw_version=$(python setup.py --version)
pip install uv
raw_version=$(uv run python -c 'from vllm_router.version import __version__; print(__version__)')
sanitized_version=${raw_version//+/-}
echo "version=$sanitized_version" >> "$GITHUB_ENV"
echo "Sanitized version: $sanitized_version"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/router-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
paths:
- 'src/vllm_router/**'
- 'docker/**'
- 'setup.py'
- 'pyproject.toml'
workflow_dispatch:

jobs:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,9 @@ helm/examples
# version files
src/vllm_router/_version.py

# pyenv / uv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

/tutorials/assets/private.yaml
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ Follow the standard GitHub workflow:
Linter checks are parts of our github workflows. To pass all linter checks, please use <code>pre-commit</code> to format your code. It is installed as follows:

```bash
pip install -r requirements-lint.txt
pre-commit install
uv sync uv sync --all-extras --all-groups
uv run pre-commit install
```

It will run automatically before every commit. You can also run it manually on
all files with:

```bash
pre-commit run --all-files
uv run pre-commit run --all-files
```

There are a subset of hooks which require additional dependencies that you may
Expand All @@ -58,9 +58,9 @@ with:

```bash
# Runs all hooks including manual stage hooks
pre-commit run --all-files --hook-stage manual
uv run pre-commit run --all-files --hook-stage manual
# Runs only the manual stage hook shellcheck
pre-commit run --all-files --hook-stage manual shellcheck
uv run pre-commit run --all-files --hook-stage manual shellcheck
```

If any of these hooks are failing in CI but you cannot run them locally, you
Expand Down
10 changes: 5 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ RUN --mount=type=cache,target=/var/lib/apt --mount=type=cache,target=/var/cache/
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*

# Copy the setup.dot py and the git metadata first (leverage Docker layer caching)
COPY setup.py .
# Copy the pyproject.toml and the git metadata first (leverage Docker layer caching)
COPY pyproject.toml .
COPY .git/ .git/

# Copy the rest of the application code
COPY src/ src/

ARG INSTALL_SENTENCE_TRANSFORMERS=true
ENV INSTALL_SENTENCE_TRANSFORMERS=${INSTALL_SENTENCE_TRANSFORMERS}
ARG INSTALL_OPTIONAL_DEP=transformer
ENV INSTALL_OPTIONAL_DEP=${INSTALL_OPTIONAL_DEP}

# Install dependencies (use cache, and delete after install, to speed up the build)
RUN pip install --upgrade --no-cache-dir pip setuptools_scm && \
pip install --no-cache-dir .
pip install --no-cache-dir .[$INSTALL_OPTIONAL_DEP]

# Set the entrypoint
ENTRYPOINT ["vllm-router"]
Expand Down
48 changes: 48 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
[project]
name = "production-stack"
dynamic = ["version"]
description = "The router for vLLM"
readme = "README.md"
requires-python = ">=3.12"
license = {text = "Apache-2.0"}
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
]
# Should be the same as src/router/requirements.txt
dependencies = [
"aiofiles==24.1.0",
"faiss-cpu==1.10.0",
"fastapi==0.115.8",
"httpx==0.28.1",
"huggingface-hub==0.25.2",
"kubernetes==32.0.0",
"numpy==1.26.4",
"prometheus-client==0.21.1",
"python-multipart==0.0.20",
"uhashring==2.3",
"uvicorn==0.34.0",
]

[project.scripts]
vllm-router = "vllm_router.app:main"

[project.urls]
Repository = "ttps://github.com/vllm-project/production-stack"

[project.optional-dependencies]
default = [] # leave this empty because pip requires at least one specifier
transformer = [
"sentence-transformers==2.2.2",
]

[build-system]
requires = ["setuptools>=68", "setuptools_scm[toml]>=8.0"]

Expand All @@ -6,3 +45,12 @@ write_to = "src/vllm_router/_version.py"

[tool.isort]
profile = "black"

[dependency-groups]
lint = [
"pre-commit>=4.1.0",
]
test = [
"pytest>=8.3.4",
"pytest-asyncio>=0.25.3",
]
1 change: 0 additions & 1 deletion requirements-lint.txt

This file was deleted.

48 changes: 0 additions & 48 deletions setup.py

This file was deleted.

Loading