Test Python 3.13 and 3.14 in CI #3551
Workflow file for this run
This file contains hidden or 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: "CI" | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - "**.md" | |
| - "**.ipynb" | |
| - "**.cff" | |
| - "docs/**" | |
| - "demo/**" | |
| - "context7.json" | |
| - "mkdocs.yml" | |
| - "zensical.toml" | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: | |
| - "**.md" | |
| - "**.ipynb" | |
| - "**.cff" | |
| - "docs/**" | |
| - "demo/**" | |
| - "context7.json" | |
| - "mkdocs.yml" | |
| - "zensical.toml" | |
| schedule: | |
| - cron: "0 0 * * *" # Runs at 00:00 UTC every day | |
| workflow_dispatch: # allow running sync via github ui button | |
| jobs: | |
| ci: | |
| name: "Tests (OS: ${{ matrix.os }}, Python: ${{ matrix.python-version }})" | |
| if: | |
| github.event_name != 'schedule' && github.event_name != | |
| 'workflow_dispatch' | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| # Cache HuggingFace downloads in the workspace so actions/cache can persist them | |
| HF_HOME: ${{ github.workspace }}/.cache/huggingface | |
| # Give flaky HF Hub downloads more headroom before timing out (default is 10s) | |
| HF_HUB_DOWNLOAD_TIMEOUT: "60" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| include: | |
| - os: macos-latest | |
| python-version: "3.12" | |
| - os: windows-latest | |
| python-version: "3.12" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup uv python package manager | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| prune-cache: false | |
| activate-environment: true | |
| cache-dependency-glob: | | |
| **/pyproject.toml | |
| - name: Cache model weights | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: tests/data/models | |
| key: | |
| ${{ runner.os }}-models-${{ hashFiles('sahi/utils/yolov5.py', | |
| 'sahi/utils/ultralytics.py', 'sahi/utils/rtdetr.py', | |
| 'sahi/utils/torchvision.py') }} | |
| restore-keys: | | |
| ${{ runner.os }}-models- | |
| - name: Cache HuggingFace Hub downloads | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ${{ github.workspace }}/.cache/huggingface | |
| key: | |
| ${{ runner.os }}-hf-${{ hashFiles('tests/utils/huggingface.py') }} | |
| restore-keys: | | |
| ${{ runner.os }}-hf- | |
| - name: Install dependencies | |
| run: uv sync --group dev --extra ci | |
| - name: List installed packages | |
| run: | | |
| echo "=== Installed Python packages ===" | |
| uv pip list | |
| echo "" | |
| echo "=== Python version ===" | |
| python --version | |
| echo "" | |
| echo "=== uv version ===" | |
| uv --version | |
| - name: Test with python ${{ matrix.python-version }} | |
| run: | | |
| # MMDet tests self-skip via pytest.importorskip when mmcv/mmdet are absent. | |
| # Retry transient network failures (e.g. HuggingFace Hub connection/timeout errors) | |
| # instead of failing the whole run. Single line so it works on both bash and Windows PowerShell. | |
| uv run pytest --capture=no -n auto --reruns 3 --reruns-delay 10 --only-rerun "(?i)(connect|connection|timed? *out|timeout|HTTPError|couldn't connect|We couldn't connect|max retries|temporarily unavailable|ConnectionError|ReadTimeout)" | |
| - name: Test SAHI CLI (without MMDet) | |
| run: | | |
| uv run sahi predict --no_sliced_prediction --model_type ultralytics --source tests/data/coco_utils/terrain1.jpg --novisual --model_path tests/data/models/ultralytics/yolo11n.pt --image_size 320 | |
| uv run sahi predict --model_type ultralytics --source tests/data/ --novisual --model_path tests/data/models/ultralytics/yolo11n.pt --image_size 320 | |
| uv run sahi predict --model_type ultralytics --source tests/data/coco_utils/terrain1.jpg --export_pickle --export_crop --model_path tests/data/models/ultralytics/yolo11n.pt --image_size 320 | |
| uv run sahi predict --model_type ultralytics --source tests/data/coco_utils/ --novisual --dataset_json_path tests/data/coco_utils/combined_coco.json --model_path tests/data/models/ultralytics/yolo11n.pt --image_size 320 | |
| # coco yolov5 | |
| uv run sahi coco yolov5 --image_dir tests/data/coco_utils/ --dataset_json_path tests/data/coco_utils/combined_coco.json --train_split 0.9 | |
| # coco evaluate | |
| uv run sahi coco evaluate --dataset_json_path tests/data/coco_evaluate/dataset.json --result_json_path tests/data/coco_evaluate/result.json | |
| # coco analyse | |
| uv run sahi coco analyse --dataset_json_path tests/data/coco_evaluate/dataset.json --result_json_path tests/data/coco_evaluate/result.json --out_dir tests/data/coco_evaluate/ | |
| schedule-test: | |
| name: | |
| "Schedule/PyPI check (OS: ${{ matrix.os }}, Python: ${{ | |
| matrix.python-version }})" | |
| if: | |
| github.event_name == 'schedule' || github.event_name == | |
| 'workflow_dispatch' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| include: | |
| - os: macos-latest | |
| python-version: "3.12" | |
| - os: windows-latest | |
| python-version: "3.12" | |
| steps: | |
| - name: Setup uv python package manager | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| prune-cache: false | |
| activate-environment: true | |
| - name: List installed packages | |
| run: | | |
| echo "=== Python version ===" | |
| python --version | |
| echo "" | |
| echo "=== uv version ===" | |
| uv --version | |
| - name: Install sahi from PyPI | |
| run: | | |
| uv pip install sahi | |
| uv pip show sahi | |
| uv run python -c "import sahi; print(sahi.__version__)" |