| 1 |
name: Run MyPy |
| 2 |
|
| 3 |
# Mypy is too slow to run as part of regular CI. The purpose of the jobs in |
| 4 |
# this file is to cover running Mypy across: |
| 5 |
# |
| 6 |
# - OSes: Linux, Windows and macOS |
| 7 |
# - Python versions: lowest/highest supported versions, and an intermediate one |
| 8 |
# |
| 9 |
# The build matrix aims for sparse coverage across those two dimensions. |
| 10 |
# Use of BLAS/LAPACK and SIMD is disabled on purpose, because those things |
| 11 |
# don't matter for static typing and this speeds up the builds. |
| 12 |
# |
| 13 |
# This is a separate job file so it's easy to trigger by hand. |
| 14 |
|
| 15 |
on: |
| 16 |
pull_request: |
| 17 |
branches: |
| 18 |
- main |
| 19 |
- maintenance/** |
| 20 |
paths-ignore: |
| 21 |
- '**.md' |
| 22 |
- '**.rst' |
| 23 |
- '.circlecl/**' |
| 24 |
- '.devcontainer/**' |
| 25 |
- '.spin/**' |
| 26 |
- 'benchmarks/**' |
| 27 |
- 'branding/**' |
| 28 |
- 'doc/**' |
| 29 |
- 'meson_cpu/**' |
| 30 |
- 'tools/**' |
| 31 |
- 'vendored-meson/**' |
| 32 |
workflow_dispatch: |
| 33 |
|
| 34 |
defaults: |
| 35 |
run: |
| 36 |
shell: bash |
| 37 |
|
| 38 |
concurrency: |
| 39 |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 40 |
cancel-in-progress: true |
| 41 |
|
| 42 |
permissions: |
| 43 |
contents: read # to fetch code (actions/checkout) |
| 44 |
|
| 45 |
jobs: |
| 46 |
mypy: |
| 47 |
# To enable this workflow on a fork, comment out: |
| 48 |
if: github.repository == 'numpy/numpy' |
| 49 |
name: "MyPy" |
| 50 |
runs-on: ${{ matrix.os_python[0] }} |
| 51 |
strategy: |
| 52 |
fail-fast: false |
| 53 |
matrix: |
| 54 |
os_python: |
| 55 |
- [macos-latest, '3.14'] |
| 56 |
- [ubuntu-latest, '3.12'] |
| 57 |
- [windows-latest, '3.11'] |
| 58 |
steps: |
| 59 |
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 |
| 60 |
with: |
| 61 |
submodules: recursive |
| 62 |
fetch-tags: true |
| 63 |
persist-credentials: false |
| 64 |
- uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 |
| 65 |
with: |
| 66 |
python-version: ${{ matrix.os_python[1] }} |
| 67 |
activate-environment: true |
| 68 |
cache-dependency-glob: | |
| 69 |
requirements/build_requirements.txt |
| 70 |
requirements/test_requirements.txt |
| 71 |
- name: Install dependencies |
| 72 |
# orjson makes mypy faster but the default requirements.txt |
| 73 |
# can't install it because orjson doesn't support 32 bit Linux |
| 74 |
run: >- |
| 75 |
uv pip install |
| 76 |
-r requirements/build_requirements.txt |
| 77 |
-r requirements/test_requirements.txt |
| 78 |
orjson |
| 79 |
- name: Build |
| 80 |
run: | |
| 81 |
spin build -j2 -- -Dallow-noblas=true -Ddisable-optimization=true --vsenv |
| 82 |
- name: Run Mypy |
| 83 |
run: | |
| 84 |
spin mypy |