Skip to content

Commit

Permalink
add cibuildwheel config
Browse files Browse the repository at this point in the history
Signed-off-by: nstarman <nstarkman@protonmail.com>
  • Loading branch information
nstarman committed Sep 9, 2022
1 parent 5811c24 commit 511d581
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 37 deletions.
7 changes: 7 additions & 0 deletions .github/mypyc-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mypy >= 0.971
mypy-extensions >= 0.4.3

# And because build isolation is disabled, we'll need to pull this too
setuptools-scm[toml] >= 6.3.1
typing-extensions > 3.10.0.1
wheel
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

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

mypyc:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:

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

update-stable-branch:
Expand Down
29 changes: 0 additions & 29 deletions licenses/LICENSE.rst

This file was deleted.

59 changes: 53 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
dependencies = [
"mypy",
"typing_extensions>=4.2",
"mypy_extensions>=0.4.3",
]

[project.optional-dependencies]
Expand Down Expand Up @@ -51,10 +52,9 @@

[build-system]
requires = [
"extension-helpers",
"mypy",
"setuptools>=45",
"setuptools_scm>=6.2",
"mypy>=0.971",
"setuptools>=45.0",
"setuptools_scm[toml]>=6.3.1",
"wheel",
]

Expand All @@ -66,6 +66,50 @@
[tool.setuptools_scm]


[tool.cibuildwheel]
build-verbosity = 1
# So these are the environments we target:
# - Python: CPython 3.8+ only
# - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64
# - OS: Linux (no musl), Windows, and macOS
build = "cp3*-*"
skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp-*"]
before-build = ["pip install -r .github/mypyc-requirements.txt"]
# This is the bare minimum needed to run the test suite. Pulling in the full
# test_requirements.txt would download a bunch of other packages not necessary
# here and would slow down the testing step a fair bit.
test-requires = ["pytest>=6.1.1"]
test-command = 'pytest {project} -k "not incompatible_with_mypyc"'
# Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't
# straight up crash)
test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"]

[tool.cibuildwheel.environment]
BLACK_USE_MYPYC = "1"
MYPYC_OPT_LEVEL = "3"
MYPYC_DEBUG_LEVEL = "0"
# The dependencies required to build wheels with mypyc aren't specified in
# [build-system].requires so we'll have to manage the build environment ourselves.
PIP_NO_BUILD_ISOLATION = "no"

[tool.cibuildwheel.linux]
before-build = [
"pip install -r .github/mypyc-requirements.txt",
"yum install -y clang",
]
# Newer images break the builds, not sure why. We'll need to investigate more later.
manylinux-x86_64-image = "quay.io/pypa/manylinux2014_x86_64:2021-11-20-f410d11"

[tool.cibuildwheel.linux.environment]
BLACK_USE_MYPYC = "1"
MYPYC_OPT_LEVEL = "3"
MYPYC_DEBUG_LEVEL = "0"
PIP_NO_BUILD_ISOLATION = "no"

[tool.cibuildwheel.windows]
before-build = ["pip install -r .github/mypyc-requirements.txt"]


[tool.autopep8]
max_line_length = 120
in-place = true
Expand Down Expand Up @@ -99,7 +143,7 @@
ensure_newline_before_comments = "True"
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
known_localfolder = "overload_numpy"
known_third_party = ["astropy", "matplotlib", "numpy", "pytest", "scipy", "setuptools"]
known_third_party = ["numpy", "pytest"]
import_heading_stdlib = "STDLIB"
import_heading_thirdparty = "THIRD PARTY"
import_heading_localfolder = "LOCAL"
Expand Down Expand Up @@ -134,7 +178,10 @@
astropy_header = "True"
doctest_plus = "enabled"
text_file_format = "rst"
addopts = "--doctest-rst --ignore-glob=docs/papers_and_presentations/*"
addopts = "--doctest-rst"
markers = [
"incompatible_with_mypyc: run when testing mypyc compiled black"
]
filterwarnings = [
# tomlkit
"ignore:The config value `project' has type `String', defaults to `str'.",
Expand Down

0 comments on commit 511d581

Please sign in to comment.