Skip to content

Commit b1d0507

Browse files
[Docs] Update to the latest mkdocs-material and add the contributing/DOCS.md (#3286)
1 parent fa6875b commit b1d0507

6 files changed

Lines changed: 72 additions & 20 deletions

File tree

.github/workflows/build-docs.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name: Build Docs
22

33
on:
44
workflow_call:
5-
inputs:
6-
release-tag:
7-
type: string
8-
required: false
95

106
jobs:
117
build-docs:
@@ -17,18 +13,10 @@ jobs:
1713
python-version: 3.11
1814
- name: Install dstack
1915
run: |
20-
uv pip install examples/plugins/example_plugin_server
21-
if [ -n "${{ inputs.release-tag }}" ]; then
22-
uv pip install "dstack[server]==${{ inputs.release-tag }}"
23-
else
24-
uv pip install -e '.[server]'
25-
fi
16+
uv sync --extra server
2617
- name: Build
2718
run: |
28-
uv pip install pillow cairosvg
2919
sudo apt-get update && sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
30-
uv pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
31-
uv pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
3220
uv run mkdocs build -s
3321
- uses: actions/upload-artifact@v4
3422
with:

.github/workflows/docs.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@ name: Build & Deploy Docs
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
release-tag:
7-
description: "dstack version"
85

96
jobs:
107
build-docs:
118
uses: ./.github/workflows/build-docs.yml
12-
with:
13-
release-tag: ${{ inputs.release-tag }}
149
secrets: inherit
1510

1611
deploy-docs:

contributing/DEVELOPMENT.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,7 @@ pyright -p .
4848
## 6. Frontend
4949

5050
See [FRONTEND.md](FRONTEND.md) for the details on how to build and develop the frontend.
51+
52+
## 7. Documentation
53+
54+
See [DOCS.md](DOCS.md) for the details on how to preview or build the documentation.

contributing/DOCS.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Documentation setup
2+
3+
## 1. Clone the repo:
4+
5+
```shell
6+
git clone https://github.com/dstackai/dstack
7+
cd dstack
8+
```
9+
10+
## 2. Install uv:
11+
12+
https://docs.astral.sh/uv/getting-started/installation
13+
14+
```shell
15+
curl -LsSf https://astral.sh/uv/install.sh | sh
16+
```
17+
18+
## 3. Install `dstack` with all extras and dev dependencies:
19+
20+
> [!WARNING]
21+
> Building documentation requires `python_version >= 3.11`.
22+
23+
```shell
24+
uv sync --all-extras
25+
```
26+
27+
`dstack` will be installed into the project's `.venv` in editable mode.
28+
29+
## 4. (Recommended) Install pre-commit hooks:
30+
31+
Code formatting and linting can be done automatically on each commit with `pre-commit` hooks:
32+
33+
```shell
34+
uv run pre-commit install
35+
```
36+
37+
## 5. Preview documentation
38+
39+
To preview the documentation, run the follow command:
40+
41+
```shell
42+
uv run mkdocs serve -w examples -s
43+
```
44+
45+
If you want to build static files, you can use the following command:
46+
47+
```shell
48+
uv run mkdocs build -s
49+
```

examples/plugins/example_plugin_server/pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name = "dstack-plugin-server"
33
version = "0.1.0"
44
description = "Example plugin server"
55
readme = "README.md"
6-
requires-python = ">=3.11"
6+
requires-python = ">=3.9"
77
dependencies = [
8-
"fastapi[standard]>=0.115.12",
8+
"fastapi",
9+
"uvicorn",
910
"dstack",
1011
]
1112

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ pattern = '<picture>\s*|<source[^>]*>\s*|\s*</picture>|<video[^>]*>\s*|</video>\
7878
replacement = ''
7979
ignore-case = true
8080

81+
[tool.uv.sources]
82+
dstack-plugin-server = { path = "examples/plugins/example_plugin_server", editable = true }
83+
8184
[tool.pyright]
8285
include = [
8386
"src/dstack/plugins",
@@ -109,6 +112,18 @@ dev = [
109112
"pytest-xdist>=3.6.1",
110113
"pyinstrument>=5.0.0",
111114
"kubernetes-stubs-elephant-fork",
115+
# docs
116+
"dstack[server]; python_version >= '3.11'",
117+
"dstack-plugin-server; python_version >= '3.11'",
118+
"pillow; python_version >= '3.11'",
119+
"cairosvg; python_version >= '3.11'",
120+
"mkdocs-material>=9.7.0; python_version >= '3.11'",
121+
"mkdocs-material[imaging]; python_version >= '3.11'",
122+
"mkdocs-material-extensions; python_version >= '3.11'",
123+
"mkdocs-redirects; python_version >= '3.11'",
124+
"mkdocs-gen-files; python_version >= '3.11'",
125+
"mkdocstrings[python]; python_version >= '3.11'",
126+
"mkdocs-render-swagger-plugin; python_version >= '3.11'",
112127
]
113128

114129
[project.optional-dependencies]

0 commit comments

Comments
 (0)