
I. Contributing to vLLM — Development Guide
1. Contributing to vLLM
Ways to contribute include:
- Reporting bugs / opening issues
- Adding support for new models
- Implementing new features
- Improving documentation
- Helping others, reviewing PRs
- Starring the repo, writing articles — these count too
2. Developing
1) Step 1: Clone the Repository
git clone https://github.com/vllm-project/vllm.gitcd vllm2) Step 2: Create a Python Environment (Recommended: uv)
uv venv --python 3.12 --seedsource .venv/bin/activateIf you don’t have uv, install it first:
curl -LsSf https://astral.sh/uv/install.sh | shTo delete the virtual environment:
rm -rf .venvuv cache clean3. Installing vLLM (Two Paths)
1) Path A: Python-only Changes (Fastest, Recommended)
VLLM_USE_PRECOMPILED=1 uv pip install -e .What this means:
- Installs in Editable Mode (
-e) — changes to source files take effect immediately - Does not compile C++/CUDA locally
- Downloads pre-compiled binaries from the corresponding pre-built wheel
👉 Advantage: Very fast, suitable for the majority of PRs.
2) Path B: CUDA/C++ Changes (Requires Local Compilation)
If you previously ran Path A, first force-remove the installed vllm Python package:
uv pip uninstall vllmInstall PyTorch (cu129):
uv pip install torch torchvision torchaudio \ --extra-index-url https://download.pytorch.org/whl/cu129Install the current project in Editable Mode:
CCACHE_NOHASHDIR="true" uv pip install --no-build-isolation -e . -vCCACHE_NOHASHDIR="true" uv pip install -e . -vuv pip install -e . installs the project in the current directory in editable mode. . refers to the current directory (i.e., the vllm repo root). It reads pyproject.toml (primary) or setup.py (legacy), then installs the project into your virtual environment.Common Error: ImportError: undefined symbol
If you encounter the following error:
(vllm) [xli49@ghpc008 vllm]$ python examples/offline_inference/basic/basic.pyTraceback (most recent call last): ... File "/data/home/xli49/vllm/vllm/platforms/cuda.py", line 16, in <module> import vllm._C # noqa ^^^^^^^^^^^^^^ImportError: /data/home/xli49/vllm/vllm/_C.abi3.so: undefined symbol: _ZN3c104cuda9SetDeviceEaThe cause is a mismatch between the torch ABI used at compile time and the torch version at runtime. Ensure you use --no-build-isolation and recompile with the correct CUDA version:
uv pip install -e . --no-build-isolationWhy Does vLLM Require --no-build-isolation?
Because compiling vLLM’s C++/CUDA extensions depends heavily on:
- The
torchinstalled in your current environment - The matching CUDA version (cu129/cu128, etc.)
- Other compilation-related packages
Without this flag, the build system uses an isolated temporary environment, which may result in:
- A mismatched
torchbeing installed in the temporary environment - The current torch’s CUDA configuration not being found
- Compilation failures or incompatible binaries being generated
4. Linting (Code Style & Formatting)
vLLM uses pre-commit to enforce a unified code style.
uv pip install pre-commit: installs the pre-commit toolpre-commit install: installs hooks into.git/hooks/so that checks run automatically on everygit commit
1) Install and Enable
uv pip install pre-commitpre-commit installFrom now on, every git commit will automatically run the checks ✅
2) Run Manually
pre-commit run # Check only staged filespre-commit run -a # Check all files (= --all-files)3) CI-only Hooks (Trigger Locally on Demand)
pre-commit run --hook-stage manual markdownlintpre-commit run --hook-stage manual mypy-3.105. Documentation
vLLM’s docs are built with MkDocs.
1) Install Documentation Dependencies
uv pip install -r requirements/docs.txt2) Preview the Docs Site Locally
mkdocs serve3) Faster Preview (Skip API Reference Generation)
Controls whether the API Reference is generated.
API_AUTONAV_EXCLUDE=vllm mkdocs servemkdocs-awesome-nav requires Python 3.10+.4) Forward the Port from a Remote Server
-L = Local port forwarding: maps a port on the remote machine to a port on your local machine.
ssh -L 8000:127.0.0.1:8000 xli49@spiedie.binghamton.edu5) Connect to a Remote GPU Node via Jump Host
-J = Jump host: connect to a target machine by hopping through an intermediate host first.
ssh -J xli49@spiedie.binghamton.edu -L 8000:127.0.0.1:8000 xli49@ghpc0056. Testing
vLLM uses pytest.
1) Path A: Full CI-equivalent Setup (CUDA)
uv pip install -r requirements/common.txt -r requirements/dev.txt --torch-backend=autopytest tests/2) Path B: Minimal Test Tooling Only
uv pip install pytest pytest-asynciopytest tests/3) Run a Single Test File (Useful for Debugging)
pytest -s -v tests/test_logger.py7. Common Errors
1) Missing Python.h
If you encounter the following error during compilation or dependency installation:
Python.h: No such file or directoryFix on Ubuntu:
sudo apt install python3-dev8. Important Warnings
✅ The repository is not yet fully covered by mypy — do not rely on mypy being fully green.
⚠️ Not all tests pass on CPU — without a GPU, many tests will fail locally. The official stance is: rely on CI for those tests.
9. PR Submission Guidelines
1) DCO Sign-off
Every commit must include a Signed-off-by line:
git commit -s -m "xxx"2) PR Title Must Include a Category Prefix
Examples:
[Bugfix] ...[Kernel] ...[Core] ...[Doc] ...[CI/Build] ...
PRs without a valid prefix may not be reviewed.
For Python-only changes, use
VLLM_USE_PRECOMPILED=1 uv pip install -e . to get started in seconds; for CUDA/C++ changes, always compile with --no-build-isolation and match your torch CUDA version to avoid ABI symbol errors.