Skip to content

Commit

Permalink
mypy: check additional directories (vllm-project#9162)
Browse files Browse the repository at this point in the history
Signed-off-by: Russell Bryant <[email protected]>
  • Loading branch information
russellb authored Oct 8, 2024
1 parent ee2bd23 commit 0cf8044
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main

jobs:
ruff:
mypy:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -32,15 +32,4 @@ jobs:
pip install types-setuptools
- name: Mypy
run: |
mypy
mypy tests --follow-imports skip
mypy vllm/attention --follow-imports skip
mypy vllm/distributed --follow-imports skip
mypy vllm/engine --follow-imports skip
mypy vllm/executor --follow-imports skip
mypy vllm/lora --follow-imports skip
mypy vllm/model_executor --follow-imports skip
mypy vllm/prompt_adapter --follow-imports skip
mypy vllm/spec_decode --follow-imports skip
mypy vllm/worker --follow-imports skip
tools/mypy.sh
12 changes: 1 addition & 11 deletions format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,7 @@ echo 'vLLM yapf: Done'

# Run mypy
echo 'vLLM mypy:'
mypy --follow-imports skip # Note that this is less strict than CI
mypy tests --follow-imports skip
mypy vllm/attention --follow-imports skip
mypy vllm/distributed --follow-imports skip
mypy vllm/engine --follow-imports skip
mypy vllm/executor --follow-imports skip
mypy vllm/lora --follow-imports skip
mypy vllm/model_executor --follow-imports skip
mypy vllm/prompt_adapter --follow-imports skip
mypy vllm/spec_decode --follow-imports skip
mypy vllm/worker --follow-imports skip
tools/mypy.sh
echo 'vLLM mypy: Done'


Expand Down
36 changes: 36 additions & 0 deletions tools/mypy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

CI=${1:-0}

run_mypy() {
echo "Running mypy on $1"
if [ $CI -eq 1 ] && [ -z "$1" ]; then
mypy "$@"
return
fi
mypy --follow-imports skip "$@"
}

run_mypy # Note that this is less strict than CI
run_mypy tests
run_mypy vllm/assets
run_mypy vllm/attention
#run_mypy vllm/compilation
#run_mypy vllm/core
run_mypy vllm/distributed
run_mypy vllm/engine
#run_mypy vllm/entrypoints
run_mypy vllm/executor
#run_mypy vllm/inputs
run_mypy vllm/logging
run_mypy vllm/lora
run_mypy vllm/model_executor
run_mypy vllm/multimodal
run_mypy vllm/platforms
run_mypy vllm/plugins
run_mypy vllm/prompt_adapter
run_mypy vllm/spec_decode
run_mypy vllm/transformers_utils
run_mypy vllm/usage
#run_mypy vllm/vllm_flash_attn
run_mypy vllm/worker
4 changes: 2 additions & 2 deletions vllm/usage/usage_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ def _report_continous_usage(self):
self._write_to_file(data)
self._send_to_server(data)

def _send_to_server(self, data):
def _send_to_server(self, data: Dict[str, Any]) -> None:
try:
global_http_client = global_http_connection.get_sync_client()
global_http_client.post(_USAGE_STATS_SERVER, json=data)
except requests.exceptions.RequestException:
# silently ignore unless we are using debug log
logging.debug("Failed to send usage data to server")

def _write_to_file(self, data):
def _write_to_file(self, data: Dict[str, Any]) -> None:
os.makedirs(os.path.dirname(_USAGE_STATS_JSON_PATH), exist_ok=True)
Path(_USAGE_STATS_JSON_PATH).touch(exist_ok=True)
with open(_USAGE_STATS_JSON_PATH, "a") as f:
Expand Down

0 comments on commit 0cf8044

Please sign in to comment.