Skip to content

Commit 3da6238

Browse files
authored
Add pre-commit based linting and formatting (#35)
* Add pre-commit workflow * Add actionlint * Add generic hooks * Add black, isort, shellcheck * Add requirements and markdown linting * Add toml * Add Dockerfile * Add codespell * Use Node.js version of `markdownlint` * Add `requirements-lint.txt` * Use CLI version of Node.js `markdownlint` * Add `pre-commit` instructions to `Contributing` * `pre-commit run -a` automatic fixes * Exclude helm templates from `check-yaml` * Comment hooks that require installed tools * Make `codespell` happy * Make `actionlint` happy * Disable `shellcheck` until it can be installed properly * Make `markdownlint` happy * Add note about running pre-commit --------- Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
1 parent 045342c commit 3da6238

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+993
-671
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: actions/checkout@v4
2929

3030
- name: Set up Python
31-
uses: actions/setup-python@v2
31+
uses: actions/setup-python@v5
3232
with:
3333
python-version: '3.8'
3434

.github/workflows/helm-lint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ jobs:
2323
- name: Lint open-webui Helm Chart
2424
run: |
2525
helm lint ./helm
26-

.github/workflows/helm-release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
git config user.name "$GITHUB_ACTOR"
2525
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2626
27-
# Could add Prometheus as a dependent chart here if desired
27+
# Could add Prometheus as a dependent chart here if desired
2828
# - name: Add Dependency Repos
2929
# run: |
3030
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
@@ -52,6 +52,5 @@ jobs:
5252
break
5353
fi
5454
REPO=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')
55-
helm push "${pkg}" oci://ghcr.io/$REPO
55+
helm push "${pkg}" "oci://ghcr.io/$REPO"
5656
done
57-
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "actionlint",
5+
"pattern": [
6+
{
7+
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"message": 4,
12+
"code": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/workflows/pre-commit.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13+
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
14+
with:
15+
python-version: "3.12"
16+
- run: echo "::add-matcher::.github/workflows/matchers/actionlint.json"
17+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.markdownlint.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
MD013: false # line-length
2+
MD028: false # no-blanks-blockquote
3+
MD029: # ol-prefix
4+
style: ordered
5+
MD033: false # no-inline-html

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
repos:
2+
- repo: https://github.com/rhysd/actionlint
3+
rev: v1.7.7
4+
hooks:
5+
- id: actionlint
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v5.0.0
8+
hooks:
9+
- id: check-json
10+
- id: check-toml
11+
- id: check-yaml
12+
exclude: ^helm/templates/
13+
- id: end-of-file-fixer
14+
- id: requirements-txt-fixer
15+
- id: trailing-whitespace
16+
# TODO: Enable these hooks when environment issues are resolved
17+
# - repo: https://github.com/hadolint/hadolint
18+
# rev: v2.12.0
19+
# hooks:
20+
# - id: hadolint
21+
# - repo: https://github.com/gruntwork-io/pre-commit
22+
# rev: v0.1.25
23+
# hooks:
24+
# - id: helmlint
25+
- repo: https://github.com/psf/black
26+
rev: '25.1.0'
27+
hooks:
28+
- id: black
29+
- repo: https://github.com/pycqa/isort
30+
rev: '6.0.0'
31+
hooks:
32+
- id: isort
33+
# TODO: Enable this hook when environment issues are resolved
34+
# - repo: https://github.com/koalaman/shellcheck-precommit
35+
# rev: v0.10.0
36+
# hooks:
37+
# - id: shellcheck
38+
- repo: https://github.com/igorshubovych/markdownlint-cli
39+
rev: v0.44.0
40+
hooks:
41+
- id: markdownlint
42+
- repo: https://github.com/codespell-project/codespell
43+
rev: v2.4.1
44+
hooks:
45+
- id: codespell

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# vLLM Production Stack: reference stack for production vLLM deployment
2-
1+
# vLLM Production Stack: reference stack for production vLLM deployment
32

43
**vLLM Production Stack** project provides a reference implementation on how to build an inference stack on top of vLLM, which allows you to:
54

65
- 🚀 Scale from single vLLM instance to distributed vLLM deployment without changing any application code
76
- 💻 Monitor the through a web dashboard
87
- 😄 Enjoy the performance benefits brought by request routing and KV cache offloading
98

10-
## Latest News:
9+
## Latest News
1110

1211
- 🔥 vLLM Production Stack is released! Checkout our [release blogs](https://blog.lmcache.ai/2025-01-21-stack-release) [01-22-2025]
1312
- ✨Join us at #production-stack channel of vLLM [slack](https://slack.vllm.ai/), LMCache [slack](https://join.slack.com/t/lmcacheworkspace/shared_invite/zt-2viziwhue-5Amprc9k5hcIdXT7XevTaQ), or fill out this [interest form](https://forms.gle/wSoeNpncmPVdXppg8) for a chat!
@@ -20,7 +19,6 @@ The stack is set up using [Helm](https://helm.sh/docs/), and contains the follow
2019
- **Request router**: Directs requests to appropriate backends based on routing keys or session IDs to maximize KV cache reuse.
2120
- **Observability stack**: monitors the metrics of the backends through [Prometheus](https://github.com/prometheus/prometheus) + [Grafana](https://grafana.com/)
2221

23-
2422
<img src="https://github.com/user-attachments/assets/8f05e7b9-0513-40a9-9ba9-2d3acca77c0c" alt="Architecture of the stack" width="800"/>
2523

2624
## Roadmap
@@ -42,6 +40,7 @@ We are actively working on this project and will release the following features
4240
### Deployment
4341

4442
vLLM Production Stack can be deployed via helm charts. Clone the repo to local and execute the following commands for a minimal deployment:
43+
4544
```bash
4645
git clone https://github.com/vllm-project/production-stack.git
4746
cd production-stack/
@@ -55,21 +54,18 @@ To validate the installation and and send query to the stack, refer to [this tut
5554

5655
For more information about customizing the helm chart, please refer to [values.yaml](https://github.com/vllm-project/production-stack/blob/main/helm/values.yaml) and our other [tutorials](https://github.com/vllm-project/production-stack/tree/main/tutorials).
5756

58-
5957
### Uninstall
6058

6159
```bash
6260
sudo helm uninstall vllm
6361
```
6462

65-
6663
## Grafana Dashboard
6764

6865
### Features
6966

7067
The Grafana dashboard provides the following insights:
7168

72-
7369
1. **Available vLLM Instances**: Displays the number of healthy instances.
7470
2. **Request Latency Distribution**: Visualizes end-to-end request latency.
7571
3. **Time-to-First-Token (TTFT) Distribution**: Monitors response times for token generation.
@@ -98,7 +94,6 @@ The router ensures efficient request distribution among backends. It supports:
9894
- Session-ID based routing
9995
- (WIP) prefix-aware routing
10096

101-
10297
## Contributing
10398

10499
Contributions are welcome! Please follow the standard GitHub flow:
@@ -107,11 +102,25 @@ Contributions are welcome! Please follow the standard GitHub flow:
107102
2. Create a feature branch.
108103
3. Submit a pull request with detailed descriptions.
109104

105+
We use `pre-commit` for formatting, it is installed as follows:
106+
107+
```bash
108+
pip install -r requirements-lint.txt
109+
pre-commit install
110+
```
111+
112+
It will run automatically before every commit. You cana also run it manually on all files with:
113+
114+
```bash
115+
pre-commit run --all-files
116+
```
117+
118+
> You can read more about `pre-commit` at <https://pre-commit.com>.
119+
110120
## License
111121

112122
This project is licensed under the MIT License. See the `LICENSE` file for details.
113123

114124
---
115125

116126
For any issues or questions, feel free to open an issue or contact the maintainers.
117-

helm/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
This helm chart lets users deploy multiple serving engines and a router into the Kubernetes cluster.
44

5-
## Key features:
5+
## Key features
66

77
- Support running multiple serving engines with multiple different models
8-
- Load the model weights directly from the existing PersistentVolumes
8+
- Load the model weights directly from the existing PersistentVolumes
99

1010
## Prerequisites
1111

12-
1. A running Kubernetes cluster with GPU. (You can set it up through `minikube`: https://minikube.sigs.k8s.io/docs/tutorials/nvidia/)
12+
1. A running Kubernetes cluster with GPU. (You can set it up through `minikube`: <https://minikube.sigs.k8s.io/docs/tutorials/nvidia/>)
1313
2. [Helm](https://helm.sh/docs/intro/install/)
1414

1515
## Install the helm chart

helm/ct.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
chart-dirs:
22
- charts
3-
validate-maintainers: false
3+
validate-maintainers: false

0 commit comments

Comments
 (0)