Skip to content

Commit 46977f9

Browse files
authored
[Doc] Add sphinx build for vllm-ascend (vllm-project#55)
### What this PR does / why we need it? This patch enables the doc build for vllm-ascend - Add sphinx build for vllm-ascend - Enable readthedocs for vllm-ascend - Fix CI: - exclude vllm-empty/tests/mistral_tool_use to skip `You need to agree to share your contact information to access this model` which introduce in vllm-project@314cfad - Install test req to fix https://github.com/vllm-project/vllm-ascend/actions/runs/13304112758/job/37151690770: ``` vllm-empty/tests/mistral_tool_use/conftest.py:4: in <module> import pytest_asyncio E ModuleNotFoundError: No module named 'pytest_asyncio' ``` - exclude docs PR ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? 1. test locally: ```bash # Install dependencies. pip install -r requirements-docs.txt # Build the docs and preview make clean; make html; python -m http.server -d build/html/ ``` Launch browser and open http://localhost:8000/. 2. CI passed with preview: https://vllm-ascend--55.org.readthedocs.build/en/55/ Signed-off-by: Yikun Jiang <yikunkero@gmail.com>
1 parent 63b11ec commit 46977f9

22 files changed

Lines changed: 255 additions & 36 deletions

.github/workflows/vllm_ascend_test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ on:
2525
- '*.txt'
2626
- '**/*.py'
2727
- '.github/workflows/vllm_ascend_test.yaml'
28+
- '!docs/**'
2829
pull_request:
2930
branches:
3031
- "main"
3132
paths:
3233
- '*.txt'
3334
- '**/*.py'
3435
- '.github/workflows/vllm_ascend_test.yaml'
36+
- '!docs/**'
3537

3638
# Bash shells do not use ~/.profile or ~/.bashrc so these shells need to be explicitly
3739
# declared as "shell: bash -el {0}" on steps that need to be properly activated.

.readthedocs.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
version: 2
5+
6+
build:
7+
os: ubuntu-22.04
8+
tools:
9+
python: "3.12"
10+
11+
sphinx:
12+
configuration: docs/source/conf.py
13+
fail_on_warning: true
14+
# If using Sphinx, optionally build your docs in additional formats such as PDF
15+
formats: []
16+
17+
# Optionally declare the Python requirements required to build your docs
18+
python:
19+
install:
20+
- requirements: docs/requirements-docs.txt

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p align="center">
22
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/vllm-project/vllm-ascend/main/docs/logos/vllm-ascend-logo-text-dark.png">
4-
<img alt="vllm-ascend" src="https://raw.githubusercontent.com/vllm-project/vllm-ascend/main/docs/logos/vllm-ascend-logo-text-light.png" width=55%>
3+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/vllm-project/vllm-ascend/main/docs/source/logos/vllm-ascend-logo-text-dark.png">
4+
<img alt="vllm-ascend" src="https://raw.githubusercontent.com/vllm-project/vllm-ascend/main/docs/source/logos/vllm-ascend-logo-text-light.png" width=55%>
55
</picture>
66
</p>
77

@@ -71,7 +71,7 @@ curl http://localhost:8000/v1/models
7171
**Please refer to [official docs](./docs/index.md) for more details.**
7272

7373
## Contributing
74-
See [CONTRIBUTING](./CONTRIBUTING.md) for more details, which is a step-by-step guide to help you set up development environment, build and test.
74+
See [CONTRIBUTING](docs/source/developer_guide/contributing.md) for more details, which is a step-by-step guide to help you set up development environment, build and test.
7575

7676
We welcome and value any contributions and collaborations:
7777
- Please feel free comments [here](https://github.com/vllm-project/vllm-ascend/issues/19) about your usage of vLLM Ascend Plugin.

README.zh.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p align="center">
22
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/vllm-project/vllm-ascend/main/docs/logos/vllm-ascend-logo-text-dark.png">
4-
<img alt="vllm-ascend" src="https://raw.githubusercontent.com/vllm-project/vllm-ascend/main/docs/logos/vllm-ascend-logo-text-light.png" width=55%>
3+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/vllm-project/vllm-ascend/main/docs/source/logos/vllm-ascend-logo-text-dark.png">
4+
<img alt="vllm-ascend" src="https://raw.githubusercontent.com/vllm-project/vllm-ascend/main/docs/source/logos/vllm-ascend-logo-text-light.png" width=55%>
55
</picture>
66
</p>
77

@@ -72,7 +72,7 @@ curl http://localhost:8000/v1/models
7272
**请参阅 [官方文档](./docs/index.md)以获取更多详细信息**
7373

7474
## 贡献
75-
有关更多详细信息,请参阅 [CONTRIBUTING](./CONTRIBUTING.md),可以更详细的帮助您部署开发环境、构建和测试。
75+
有关更多详细信息,请参阅 [CONTRIBUTING](docs/source/developer_guide/contributing.zh.md),可以更详细的帮助您部署开发环境、构建和测试。
7676

7777
我们欢迎并重视任何形式的贡献与合作:
7878
- 您可以在[这里](https://github.com/vllm-project/vllm-ascend/issues/19)反馈您的使用体验。

docs/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+

docs/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# vLLM Ascend Plugin documents
2+
3+
## Build the docs
4+
5+
```bash
6+
# Install dependencies.
7+
pip install -r requirements-docs.txt
8+
9+
# Build the docs.
10+
make clean
11+
make html
12+
```
13+
14+
## Open the docs with your browser
15+
16+
```bash
17+
python -m http.server -d build/html/
18+
```
19+
20+
Launch your browser and open http://localhost:8000/.
21+

docs/index.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/requirements-docs.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sphinx==6.2.1
2+
sphinx-argparse==0.4.0
3+
sphinx-book-theme==1.0.1
4+
sphinx-copybutton==0.5.2
5+
sphinx-design==0.6.1
6+
sphinx-togglebutton==0.3.2
7+
myst-parser==3.0.1
8+
msgspec

docs/requirements-test.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pytest-asyncio
2+

docs/source/conf.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#
2+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
3+
# This file is a part of the vllm-ascend project.
4+
# Adapted from vllm-project/vllm/docs/source/conf.py
5+
# Copyright 2023 The vLLM team.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
# -- Path setup --------------------------------------------------------------
21+
22+
# If extensions (or modules to document with autodoc) are in another directory,
23+
# add these directories to sys.path here. If the directory is relative to the
24+
# documentation root, use os.path.abspath to make it absolute, like shown here.
25+
#
26+
# import os
27+
# import sys
28+
# sys.path.insert(0, os.path.abspath('.'))
29+
30+
# -- Project information -----------------------------------------------------
31+
32+
project = 'vllm-ascend'
33+
copyright = '2025, vllm-ascend team'
34+
author = 'the vllm-ascend team'
35+
36+
# The full version, including alpha/beta/rc tags
37+
release = ''
38+
39+
# -- General configuration ---------------------------------------------------
40+
41+
# Add any Sphinx extension module names here, as strings. They can be
42+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
43+
# ones.
44+
45+
# Copy from https://github.com/vllm-project/vllm/blob/main/docs/source/conf.py
46+
extensions = [
47+
"sphinx.ext.napoleon",
48+
"sphinx.ext.intersphinx",
49+
"sphinx_copybutton",
50+
"sphinx.ext.autodoc",
51+
"sphinx.ext.autosummary",
52+
"myst_parser",
53+
"sphinxarg.ext",
54+
"sphinx_design",
55+
"sphinx_togglebutton",
56+
]
57+
myst_enable_extensions = [
58+
"colon_fence",
59+
]
60+
61+
# Add any paths that contain templates here, relative to this directory.
62+
templates_path = ['_templates']
63+
64+
# The language for content autogenerated by Sphinx. Refer to documentation
65+
# for a list of supported languages.
66+
#
67+
# This is also used if you do content translation via gettext catalogs.
68+
# Usually you set "language" from the command line for these cases.
69+
language = 'en'
70+
71+
# List of patterns, relative to source directory, that match files and
72+
# directories to ignore when looking for source files.
73+
# This pattern also affects html_static_path and html_extra_path.
74+
exclude_patterns = [
75+
'_build',
76+
'Thumbs.db',
77+
'.DS_Store',
78+
'.venv',
79+
'README.md',
80+
# TODO(yikun): Remove this after zh supported
81+
'developer_guide/contributing.zh.md'
82+
]
83+
84+
# -- Options for HTML output -------------------------------------------------
85+
86+
# The theme to use for HTML and HTML Help pages. See the documentation for
87+
# a list of builtin themes.
88+
#
89+
html_title = project
90+
html_theme = 'sphinx_book_theme'
91+
html_logo = 'logos/vllm-ascend-logo-text-light.png'
92+
html_theme_options = {
93+
'path_to_docs': 'docs/source',
94+
'repository_url': 'https://github.com/vllm-project/vllm-ascend',
95+
'use_repository_button': True,
96+
'use_edit_page_button': True,
97+
}
98+
# Add any paths that contain custom static files (such as style sheets) here,
99+
# relative to this directory. They are copied after the builtin static files,
100+
# so a file named "default.css" will overwrite the builtin "default.css".
101+
# html_static_path = ['_static']
102+
103+
104+
def setup(app):
105+
pass

0 commit comments

Comments
 (0)