-
-
Notifications
You must be signed in to change notification settings - Fork 12.3k
105 lines (98 loc) · 3.04 KB
/
typecheck.yml
File metadata and controls
105 lines (98 loc) · 3.04 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Type-checking
# Mypy is too slow to run as part of regular CI. The purpose of the jobs in
# this file is to cover running Mypy across:
#
# - OSes: Linux, Windows and macOS
# - Python versions: lowest/highest supported versions, and an intermediate one
#
# The build matrix aims for sparse coverage across those two dimensions.
# Use of BLAS/LAPACK and SIMD is disabled on purpose, because those things
# don't matter for static typing and this speeds up the builds.
#
# This is a separate job file so it's easy to trigger by hand.
on:
pull_request:
branches:
- main
- maintenance/**
paths-ignore:
- '**.md'
- '**.rst'
- '.circlecl/**'
- '.devcontainer/**'
- '.spin/**'
- 'benchmarks/**'
- 'branding/**'
- 'doc/**'
- 'meson_cpu/**'
- 'tools/**'
- 'vendored-meson/**'
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
mypy:
# To enable this workflow on a fork, comment out:
if: github.repository == 'numpy/numpy'
name: "MyPy"
runs-on: ${{ matrix.os_python[0] }}
strategy:
fail-fast: false
matrix:
os_python:
- [macos-latest, '3.14']
- [ubuntu-latest, '3.13']
- [windows-latest, '3.12']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
fetch-tags: true
persist-credentials: false
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
python-version: ${{ matrix.os_python[1] }}
activate-environment: true
cache-dependency-glob: |
requirements/build_requirements.txt
requirements/typing_requirements.txt
- name: Install dependencies
# orjson makes mypy faster but the default requirements.txt
# can't install it because orjson doesn't support 32 bit Linux
run: >-
uv pip install
-r requirements/build_requirements.txt
-r requirements/typing_requirements.txt
orjson
basedpyright
- name: Build
run: |
spin build -j2 -- -Dallow-noblas=true -Ddisable-optimization=true --vsenv
- name: Run Mypy
run: |
spin mypy
- name: Check basedpyright's type completeness is at least 100%
run: >-
spin run python tools/pyright_completeness.py
--verifytypes numpy
--ignoreexternal
--exclude-like '*.tests.*' '*.conftest.*'
pyrefly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
activate-environment: true
- name: Install dependencies
run: >-
uv pip install
-r requirements/typing_requirements.txt
- name: Run pyrefly
run: pyrefly check