Unverified Commit 32baf1d0 authored by Harry Mellor's avatar Harry Mellor Committed by GitHub
Browse files

[Docs] Clean up the contributing README (#25099)


Signed-off-by: default avatarHarry Mellor <19981378+hmellor@users.noreply.github.com>
parent 3127274d
...@@ -26,113 +26,123 @@ See <gh-file:LICENSE>. ...@@ -26,113 +26,123 @@ See <gh-file:LICENSE>.
## Developing ## Developing
--8<-- "docs/getting_started/installation/python_env_setup.inc.md" The first step of contributing to vLLM is to clone the GitHub repository:
Depending on the kind of development you'd like to do (e.g. Python, CUDA), you can choose to build vLLM with or without compilation.
Check out the [building from source][build-from-source] documentation for details.
For an optimized workflow when iterating on C++/CUDA kernels, see the [Incremental Compilation Workflow](./incremental_build.md) for recommendations. ```bash
git clone https://github.com/vllm-project/vllm.git
cd vllm
```
### Building the docs with MkDocs Then, configure your Python virtual environment.
#### Introduction to MkDocs --8<-- "docs/getting_started/installation/python_env_setup.inc.md"
[MkDocs](https://github.com/mkdocs/mkdocs) is a fast, simple and downright gorgeous static site generator that's geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file. If you are only developing vLLM's Python code, install vLLM using:
#### Install MkDocs and Plugins ```bash
VLLM_USE_PRECOMPILED=1 uv pip install -e .
```
Install MkDocs along with the [plugins](https://github.com/vllm-project/vllm/blob/main/mkdocs.yaml) used in the vLLM documentation, as well as required dependencies: If you are developing vLLM's Python and CUDA/C++ code, install vLLM using:
```bash ```bash
uv pip install -r requirements/docs.txt uv pip install -e .
``` ```
!!! note For more details about installing from source and installing for other hardware, check out the [installation instructions](../getting_started/installation/README.md) for your hardware and head to the "Build wheel from source" section.
Ensure that your Python version is compatible with the plugins (e.g., `mkdocs-awesome-nav` requires Python 3.10+)
#### Verify Installation For an optimized workflow when iterating on C++/CUDA kernels, see the [Incremental Compilation Workflow](./incremental_build.md) for recommendations.
Confirm that MkDocs is correctly installed: !!! tip
vLLM is compatible with Python versions 3.9 to 3.12. However, vLLM's default [Dockerfile](gh-file:docker/Dockerfile) ships with Python 3.12 and tests in CI (except `mypy`) are run with Python 3.12.
```bash Therefore, we recommend developing with Python 3.12 to minimise the chance of your local environment clashing with our CI environment.
mkdocs --version
```
Example output: ### Linting
```console vLLM uses `pre-commit` to lint and format the codebase. See <https://pre-commit.com/#usage> if `pre-commit` is new to you. Setting up `pre-commit` is as easy as:
mkdocs, version 1.6.1 from /opt/miniconda3/envs/mkdoc/lib/python3.10/site-packages/mkdocs (Python 3.10)
```
#### Clone the `vLLM` repository
```bash ```bash
git clone https://github.com/vllm-project/vllm.git uv pip install pre-commit
cd vllm pre-commit install
``` ```
#### Start the Development Server vLLM's `pre-commit` hooks will now run automatically every time you commit.
MkDocs comes with a built-in dev-server that lets you preview your documentation as you work on it. Make sure you're in the same directory as the `mkdocs.yml` configuration file, and then start the server by running the `mkdocs serve` command: !!! tip "Tips"
You can manually run the `pre-commit` hooks using:
```bash ```bash
mkdocs serve pre-commit run # runs on staged files
``` pre-commit run -a # runs on all files (short for --all-files)
```
Example output: ---
```console Some `pre-commit` hooks only run in CI. If you need to, you can run them locally with:
INFO - Documentation built in 106.83 seconds
INFO - [22:02:02] Watching paths for changes: 'docs', 'mkdocs.yaml'
INFO - [22:02:02] Serving on http://127.0.0.1:8000/
```
#### View in Your Browser ```bash
pre-commit run --hook-stage manual markdownlint
pre-commit run --hook-stage manual mypy-3.9
```
Open up [http://127.0.0.1:8000/](http://127.0.0.1:8000/) in your browser to see a live preview:. ### Documentation
#### Learn More MkDocs is a fast, simple and downright gorgeous static site generator that's geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file, <gh-file:mkdocs.yaml>.
For additional features and advanced configurations, refer to the official [MkDocs Documentation](https://www.mkdocs.org/). Get started with:
## Testing ```bash
uv pip install -r requirements/docs.txt
```
??? console "Commands" !!! tip
Ensure that your Python version is compatible with the plugins
(e.g., `mkdocs-awesome-nav` requires Python 3.10+)
```bash MkDocs comes with a built-in dev-server that lets you preview your documentation as you work on it.
# These commands are only for Nvidia CUDA platforms. From the root of the repository, run:
uv pip install -r requirements/common.txt -r requirements/dev.txt --torch-backend=auto
# Linting, formatting and static type checking ```bash
pre-commit install mkdocs serve # with API ref (~10 minutes)
API_AUTONAV_EXCLUDE=vllm mkdocs serve # API ref off (~15 seconds)
```
# You can manually run pre-commit with Once you see `Serving on http://127.0.0.1:8000/` in the logs, the live preview is ready!
pre-commit run --all-files --show-diff-on-failure Open <http://127.0.0.1:8000/> in your browser to see it.
# To manually run something from CI that does not run For additional features and advanced configurations, refer to the:
# locally by default, you can run:
pre-commit run mypy-3.9 --hook-stage manual --all-files
# Unit tests - [MkDocs documentation](https://www.mkdocs.org/)
pytest tests/ - [Material for MkDocs documentation](https://squidfunk.github.io/mkdocs-material/) (the MkDocs theme we use)
# Run tests for a single test file with detailed output ### Testing
pytest -s -v tests/test_logger.py
```
!!! tip vLLM uses `pytest` to test the codebase.
Since the <gh-file:docker/Dockerfile> ships with Python 3.12, all tests in CI (except `mypy`) are run with Python 3.12.
Therefore, we recommend developing with Python 3.12 to minimise the chance of your local environment clashing with our CI environment. ```bash
# Install the test dependencies used in CI (CUDA only)
uv pip install -r requirements/common.txt -r requirements/dev.txt --torch-backend=auto
# Install some common test dependencies (hardware agnostic)
uv pip install pytest pytest-asyncio
# Run all tests
pytest tests/
!!! note "Install python3-dev if Python.h is missing" # Run tests for a single test file with detailed output
pytest -s -v tests/test_logger.py
```
!!! tip "Install python3-dev if Python.h is missing"
If any of the above commands fails with `Python.h: No such file or directory`, install If any of the above commands fails with `Python.h: No such file or directory`, install
`python3-dev` with `sudo apt install python3-dev`. `python3-dev` with `sudo apt install python3-dev`.
!!! note !!! warning "Warnings"
Currently, the repository is not fully checked by `mypy`. Currently, the repository is not fully checked by `mypy`.
!!! note ---
Currently, not all unit tests pass when run on CPU platforms. If you don't have access to a GPU Currently, not all unit tests pass when run on CPU platforms. If you don't have access to a GPU
platform to run unit tests locally, rely on the continuous integration system to run the tests for platform to run unit tests locally, rely on the continuous integration system to run the tests for
now. now.
...@@ -194,8 +204,7 @@ appropriately to indicate the type of change. Please use one of the following: ...@@ -194,8 +204,7 @@ appropriately to indicate the type of change. Please use one of the following:
The PR needs to meet the following code quality standards: The PR needs to meet the following code quality standards:
- We adhere to [Google Python style guide](https://google.github.io/styleguide/pyguide.html) and [Google C++ style guide](https://google.github.io/styleguide/cppguide.html). - We adhere to [Google Python style guide](https://google.github.io/styleguide/pyguide.html) and [Google C++ style guide](https://google.github.io/styleguide/cppguide.html).
- Pass all linter checks. Please use `pre-commit` to format your code. See - Pass all linter checks.
<https://pre-commit.com/#usage> if `pre-commit` is new to you.
- The code needs to be well-documented to ensure future contributors can easily - The code needs to be well-documented to ensure future contributors can easily
understand the code. understand the code.
- Include sufficient tests to ensure the project stays correct and robust. This - Include sufficient tests to ensure the project stays correct and robust. This
......
It's recommended to use [uv](https://docs.astral.sh/uv/), a very fast Python environment manager, to create and manage Python environments. Please follow the [documentation](https://docs.astral.sh/uv/#getting-started) to install `uv`. After installing `uv`, you can create a new Python environment and install vLLM using the following commands: It's recommended to use [uv](https://docs.astral.sh/uv/), a very fast Python environment manager, to create and manage Python environments. Please follow the [documentation](https://docs.astral.sh/uv/#getting-started) to install `uv`. After installing `uv`, you can create a new Python environment using the following commands:
```bash ```bash
uv venv --python 3.12 --seed uv venv --python 3.12 --seed
......
...@@ -79,6 +79,7 @@ plugins: ...@@ -79,6 +79,7 @@ plugins:
- "re:vllm\\._.*" # Internal modules - "re:vllm\\._.*" # Internal modules
- "vllm.third_party" - "vllm.third_party"
- "vllm.vllm_flash_attn" - "vllm.vllm_flash_attn"
- !ENV [API_AUTONAV_EXCLUDE, ""]
- mkdocstrings: - mkdocstrings:
handlers: handlers:
python: python:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment