-
Notifications
You must be signed in to change notification settings - Fork 499
48 lines (41 loc) · 1.43 KB
/
python-quality.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Python quality
on:
push:
branches:
- main
paths-ignore:
- "js/**"
- "api-inference-community/**"
pull_request:
types: [assigned, opened, synchronize, reopened]
paths-ignore:
- "js/**"
- "api-inference-community/**"
jobs:
check_code_quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
# Setup venv
# TODO: revisit when https://github.com/astral-sh/uv/issues/1526 is addressed.
- name: Setup venv + uv
run: |
pip install --upgrade uv
uv venv
- name: Install dependencies
run: uv pip install "huggingface_hub[dev] @ ."
- run: .venv/bin/ruff check tests src contrib # linter
- run: .venv/bin/ruff format --check tests src contrib # formatter
- run: .venv/bin/python utils/check_contrib_list.py
- run: .venv/bin/python utils/check_static_imports.py
- run: .venv/bin/python utils/generate_async_inference_client.py
- run: .venv/bin/python utils/generate_inference_types.py
# Run type checking at least on huggingface_hub root file to check all modules
# that can be lazy-loaded actually exist.
- run: .venv/bin/mypy src/huggingface_hub/__init__.py --follow-imports=silent --show-traceback
# Run mypy on full package
- run: .venv/bin/mypy src