Repository navigation
Expand file tree
/
Copy pathcibuildwheel.toml
More file actions
105 lines (90 loc) · 3.85 KB
/
Copy pathcibuildwheel.toml
File metadata and controls
105 lines (90 loc) · 3.85 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
[tool.cibuildwheel]
build-frontend = "build"
linux.manylinux-x86_64-image = "manylinux_2_28"
linux.manylinux-aarch64-image = "manylinux_2_28"
linux.musllinux-x86_64-image = "musllinux_1_2"
linux.musllinux-aarch64-image = "musllinux_1_2"
enable = []
# Don't build musllinux arm64, 32-bit Windows and macOS x86_64.
# PyPy and 32-bit Linux are skipped by default.
# We also skip Pyodide on Python 3.13, because there is no wheel for ast-serialize.
# To be more precise, although we ship a stable ABI wheel, its platform tag may be different
# for different Python versions, e.g. pyemscripten_2025_0_wasm32 vs pyemscripten_2026_0_wasm32,
# And we cannot build Python 3.13 ast-serialize wheel because Pyodide on Python 3.13 requires
# a Rust version that is incompatible with Ruff crates we depend on.
skip = [
"*-win32",
"*-macosx_x86_64",
"*-musllinux_aarch64",
"cp313-pyodide_wasm32",
]
build-verbosity = 1
linux.before-all = [
"yum install -y llvm-toolset || yum -v install -y llvm-toolset",
]
before-test = [
"pip install -r {project}/mypy/test-requirements.txt",
]
# Use minimal setup on Pyodide as there are no wheels for some dependencies (e.g. lxml).
pyodide.before-test = [
"pip install pytest>=8.1.0 pytest-xdist>=1.34.0 -r {project}/mypy/mypy-requirements.txt",
]
# pytest looks for configuration files in the parent directories of where the tests live.
# since we are trying to run the tests from their installed location, we copy those into
# the venv. Ew ew ew.
# We don't run external mypyc tests since there's some issue with compilation on the
# manylinux image we use.
test-command = """ \
( \
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))') \
&& cp '{project}/mypy/pyproject.toml' '{project}/mypy/conftest.py' $DIR \
\
&& MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])') \
&& MYPYC_TEST_DIR=$(python -c 'import mypyc.test; print(mypyc.test.__path__[0])') \
\
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR $MYPYC_TEST_DIR -k 'not test_external' \
)
"""
# I ran into some flaky tests on Windows, so only run testcheck. It looks like we
# previously didn't run any tests on windows wheels, so this is a net win.
windows.test-command = """ \
bash -c "( \
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))') \
&& cp '{project}/mypy/pyproject.toml' '{project}/mypy/conftest.py' $DIR \
\
&& MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])') \
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR/testcheck.py \
)"
"""
# Similarly, on Pyodide we can only run a subset of tests, but this is already an improvement.
pyodide.test-command = """ \
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))') \
&& cp '{project}/mypy/pyproject.toml' '{project}/mypy/conftest.py' $DIR \
\
&& MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])') \
&& MYPY_TEST_PREFIX='{project}/mypy' python -m pytest -n0 $MYPY_TEST_DIR/testcheck.py
"""
[tool.cibuildwheel.config-settings]
--build-option = "--use-mypyc"
[tool.cibuildwheel.environment]
MYPYC_OPT_LEVEL = "3"
MYPYC_DEBUG_LEVEL = "0"
[tool.cibuildwheel.windows.environment]
MYPYC_OPT_LEVEL = "2"
MYPYC_DEBUG_LEVEL = "0"
[tool.cibuildwheel.linux.environment]
# Add llvm paths to environment to eliminate scl usage (like manylinux image does for gcc toolset).
MYPYC_OPT_LEVEL = "3"
MYPYC_DEBUG_LEVEL = "0"
PATH="$PATH:/opt/rh/llvm-toolset-17.0/root/usr/bin"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/rh/llvm-toolset-17.0/root/usr/lib64"
CC="clang"
[[tool.cibuildwheel.overrides]]
select = "*musllinux*"
before-all = [
"apk add --no-cache clang",
]
before-test = [
"pip install -r {project}/mypy/test-requirements.txt",
]
environment = { MYPYC_OPT_LEVEL="3", MYPYC_DEBUG_LEVEL="0", CC="clang" }