Skip to content

Commit a2d1b46

Browse files
Build wheels for mypy 1.19.0-oaipatch
1 parent 53b3051 commit a2d1b46

File tree

3 files changed

+53
-32
lines changed

3 files changed

+53
-32
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ concurrency:
66
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
77
cancel-in-progress: true
88

9+
permissions:
10+
contents: write
11+
912
jobs:
1013
generate_wheels_matrix:
1114
name: Generate wheels matrix
@@ -19,7 +22,7 @@ jobs:
1922
# use a commit hash checked into a file to get the mypy revision to build.
2023
# submodules prove problematic since .git is outside cibuildwheel's manylinux container
2124
run: |
22-
git clone https://github.com/python/mypy.git --recurse-submodules
25+
git clone https://github.com/michaelm-openai/mypy.git --recurse-submodules
2326
git -C mypy checkout $(cat mypy_commit)
2427
- name: Install cibuildwheel and pypyp
2528
run: |
@@ -56,15 +59,23 @@ jobs:
5659

5760
steps:
5861
- uses: actions/checkout@v6
62+
- name: Restore wheel cache
63+
id: cache_wheels
64+
uses: actions/cache@v4
65+
with:
66+
path: wheelhouse
67+
key: wheels-${{ runner.os }}-${{ matrix.only }}-${{ hashFiles('mypy_commit') }}
5968
- name: Checkout mypy
6069
shell: bash
70+
if: steps.cache_wheels.outputs.cache-hit != 'true'
6171
# use a commit hash checked into a file to get the mypy revision to build.
6272
# submodules prove problematic since .git is outside cibuildwheel's manylinux container
6373
run: |
64-
git clone https://github.com/python/mypy.git --recurse-submodules
74+
git clone https://github.com/michaelm-openai/mypy.git --recurse-submodules
6575
git -C mypy checkout $(cat mypy_commit)
6676
6777
- uses: pypa/cibuildwheel@v3.3.1
78+
if: steps.cache_wheels.outputs.cache-hit != 'true'
6879
with:
6980
config-file: cibuildwheel.toml
7081
package-dir: mypy
@@ -81,24 +92,34 @@ jobs:
8192
runs-on: ubuntu-latest
8293
steps:
8394
- uses: actions/checkout@v6
95+
- name: Restore sdist cache
96+
id: cache_sdist
97+
uses: actions/cache@v4
98+
with:
99+
path: mypy/dist
100+
key: sdist-${{ hashFiles('mypy_commit') }}
84101
- uses: actions/setup-python@v6
85102
name: Install Python
103+
if: steps.cache_sdist.outputs.cache-hit != 'true'
86104
with:
87105
python-version: "3.14"
88106
- name: Checkout mypy
89107
shell: bash
108+
if: steps.cache_sdist.outputs.cache-hit != 'true'
90109
run: |
91110
COMMIT=$(cat mypy_commit)
92-
git clone https://github.com/python/mypy.git
111+
git clone https://github.com/michaelm-openai/mypy.git
93112
cd mypy
94113
git checkout $COMMIT
95114
git submodule update --init --recursive
96115
- name: Run check-manifest
116+
if: steps.cache_sdist.outputs.cache-hit != 'true'
97117
run: |
98118
cd mypy
99119
pip install check-manifest
100120
check-manifest -v
101121
- name: Build sdist and wheel
122+
if: steps.cache_sdist.outputs.cache-hit != 'true'
102123
run: |
103124
cd mypy
104125
pip install --upgrade setuptools build
@@ -139,7 +160,7 @@ jobs:
139160
shell: bash
140161
run: |
141162
COMMIT=$(cat mypy_commit)
142-
git clone https://github.com/python/mypy.git
163+
git clone https://github.com/michaelm-openai/mypy.git
143164
cd mypy
144165
git checkout $COMMIT
145166
git submodule update --init --recursive
@@ -184,7 +205,7 @@ jobs:
184205
# https://github.com/actions/upload-release-asset/issues/47
185206
uses: actions/github-script@v8
186207
with:
187-
github-token: ${{secrets.GITHUB_TOKEN}}
208+
github-token: ${{secrets.GH_TOKEN}}
188209
script: |
189210
const fs = require('fs').promises;
190211
const { repo: { owner, repo }, sha } = context;

cibuildwheel.toml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,38 @@ linux.before-all = [
2323
"yum install -y llvm-toolset || yum -v install -y llvm-toolset",
2424
]
2525

26-
before-test = [
27-
"pip install -r {project}/mypy/test-requirements.txt",
28-
]
26+
# before-test = [
27+
# "pip install -r {project}/mypy/test-requirements.txt",
28+
# ]
2929

3030
# pytest looks for configuration files in the parent directories of where the tests live.
3131
# since we are trying to run the tests from their installed location, we copy those into
3232
# the venv. Ew ew ew.
3333
# We don't run external mypyc tests since there's some issue with compilation on the
3434
# manylinux image we use.
35-
test-command = """ \
36-
( \
37-
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))') \
38-
&& cp '{project}/mypy/pyproject.toml' '{project}/mypy/conftest.py' $DIR \
39-
\
40-
&& MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])') \
41-
&& MYPYC_TEST_DIR=$(python -c 'import mypyc.test; print(mypyc.test.__path__[0])') \
42-
\
43-
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR $MYPYC_TEST_DIR -k 'not test_external' \
44-
)
45-
"""
35+
# test-command = """ \
36+
# ( \
37+
# DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))') \
38+
# && cp '{project}/mypy/pyproject.toml' '{project}/mypy/conftest.py' $DIR \
39+
# \
40+
# && MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])') \
41+
# && MYPYC_TEST_DIR=$(python -c 'import mypyc.test; print(mypyc.test.__path__[0])') \
42+
# \
43+
# && MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR $MYPYC_TEST_DIR -k 'not test_external' \
44+
# )
45+
# """
4646

4747
# I ran into some flaky tests on windows, so only run testcheck. it looks like we
4848
# previously didn't run any tests on windows wheels, so this is a net win.
49-
windows.test-command = """ \
50-
bash -c "( \
51-
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))') \
52-
&& cp '{project}/mypy/pyproject.toml' '{project}/mypy/conftest.py' $DIR \
53-
\
54-
&& MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])') \
55-
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR/testcheck.py \
56-
)"
57-
"""
49+
# windows.test-command = """ \
50+
# bash -c "( \
51+
# DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))') \
52+
# && cp '{project}/mypy/pyproject.toml' '{project}/mypy/conftest.py' $DIR \
53+
# \
54+
# && MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])') \
55+
# && MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR/testcheck.py \
56+
# )"
57+
# """
5858

5959
[tool.cibuildwheel.config-settings]
6060
--build-option = "--use-mypyc"
@@ -80,7 +80,7 @@ select = "*musllinux*"
8080
before-all = [
8181
"apk add --no-cache clang",
8282
]
83-
before-test = [
84-
"pip install -r {project}/mypy/test-requirements.txt",
85-
]
83+
# before-test = [
84+
# "pip install -r {project}/mypy/test-requirements.txt",
85+
# ]
8686
environment = { MYPYC_OPT_LEVEL="3", MYPYC_DEBUG_LEVEL="0", CC="clang" }

mypy_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7fee02ca109ad511bb55efd83ec13efc7f7eabfb
1+
abdb6f9fde76302cdc96cef06a9f52f523d6a54c

0 commit comments

Comments
 (0)