Add CI to auto-generate inference types #7287
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
env: | |
UV_HTTP_TIMEOUT: 600 # max 10min to install deps | |
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_inference_input_params.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: .venv/bin/python utils/generate_task_parameters.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 |