Skip to content

Commit 511d581

Browse files
committed
add cibuildwheel config
Signed-off-by: nstarman <nstarkman@protonmail.com>
1 parent 5811c24 commit 511d581

File tree

4 files changed

+62
-37
lines changed

4 files changed

+62
-37
lines changed

.github/mypyc-requirements.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mypy >= 0.971
2+
mypy-extensions >= 0.4.3
3+
4+
# And because build isolation is disabled, we'll need to pull this too
5+
setuptools-scm[toml] >= 6.3.1
6+
typing-extensions > 3.10.0.1
7+
wheel

.github/workflows/python-publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Upload to PyPI via Twine
3535
env:
36-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
36+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
3737
run: twine upload --verbose -u '__token__' dist/*
3838

3939
mypyc:
@@ -75,7 +75,7 @@ jobs:
7575

7676
- name: Upload wheels to PyPI via Twine
7777
env:
78-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
78+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
7979
run: pipx run twine upload --verbose -u '__token__' wheelhouse/*.whl
8080

8181
update-stable-branch:

licenses/LICENSE.rst

-29
This file was deleted.

pyproject.toml

+53-6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
dependencies = [
2323
"mypy",
2424
"typing_extensions>=4.2",
25+
"mypy_extensions>=0.4.3",
2526
]
2627

2728
[project.optional-dependencies]
@@ -51,10 +52,9 @@
5152

5253
[build-system]
5354
requires = [
54-
"extension-helpers",
55-
"mypy",
56-
"setuptools>=45",
57-
"setuptools_scm>=6.2",
55+
"mypy>=0.971",
56+
"setuptools>=45.0",
57+
"setuptools_scm[toml]>=6.3.1",
5858
"wheel",
5959
]
6060

@@ -66,6 +66,50 @@
6666
[tool.setuptools_scm]
6767

6868

69+
[tool.cibuildwheel]
70+
build-verbosity = 1
71+
# So these are the environments we target:
72+
# - Python: CPython 3.8+ only
73+
# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64
74+
# - OS: Linux (no musl), Windows, and macOS
75+
build = "cp3*-*"
76+
skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp-*"]
77+
before-build = ["pip install -r .github/mypyc-requirements.txt"]
78+
# This is the bare minimum needed to run the test suite. Pulling in the full
79+
# test_requirements.txt would download a bunch of other packages not necessary
80+
# here and would slow down the testing step a fair bit.
81+
test-requires = ["pytest>=6.1.1"]
82+
test-command = 'pytest {project} -k "not incompatible_with_mypyc"'
83+
# Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't
84+
# straight up crash)
85+
test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"]
86+
87+
[tool.cibuildwheel.environment]
88+
BLACK_USE_MYPYC = "1"
89+
MYPYC_OPT_LEVEL = "3"
90+
MYPYC_DEBUG_LEVEL = "0"
91+
# The dependencies required to build wheels with mypyc aren't specified in
92+
# [build-system].requires so we'll have to manage the build environment ourselves.
93+
PIP_NO_BUILD_ISOLATION = "no"
94+
95+
[tool.cibuildwheel.linux]
96+
before-build = [
97+
"pip install -r .github/mypyc-requirements.txt",
98+
"yum install -y clang",
99+
]
100+
# Newer images break the builds, not sure why. We'll need to investigate more later.
101+
manylinux-x86_64-image = "quay.io/pypa/manylinux2014_x86_64:2021-11-20-f410d11"
102+
103+
[tool.cibuildwheel.linux.environment]
104+
BLACK_USE_MYPYC = "1"
105+
MYPYC_OPT_LEVEL = "3"
106+
MYPYC_DEBUG_LEVEL = "0"
107+
PIP_NO_BUILD_ISOLATION = "no"
108+
109+
[tool.cibuildwheel.windows]
110+
before-build = ["pip install -r .github/mypyc-requirements.txt"]
111+
112+
69113
[tool.autopep8]
70114
max_line_length = 120
71115
in-place = true
@@ -99,7 +143,7 @@
99143
ensure_newline_before_comments = "True"
100144
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
101145
known_localfolder = "overload_numpy"
102-
known_third_party = ["astropy", "matplotlib", "numpy", "pytest", "scipy", "setuptools"]
146+
known_third_party = ["numpy", "pytest"]
103147
import_heading_stdlib = "STDLIB"
104148
import_heading_thirdparty = "THIRD PARTY"
105149
import_heading_localfolder = "LOCAL"
@@ -134,7 +178,10 @@
134178
astropy_header = "True"
135179
doctest_plus = "enabled"
136180
text_file_format = "rst"
137-
addopts = "--doctest-rst --ignore-glob=docs/papers_and_presentations/*"
181+
addopts = "--doctest-rst"
182+
markers = [
183+
"incompatible_with_mypyc: run when testing mypyc compiled black"
184+
]
138185
filterwarnings = [
139186
# tomlkit
140187
"ignore:The config value `project' has type `String', defaults to `str'.",

0 commit comments

Comments
 (0)