Skip to content

Commit a5bdba1

Browse files
authored
v1.0.0: Update numpy pins (#109)
* Update pins and bump version * Remove old pythons * Remove Python3.9 * Set macos 13 * Reenable 3.9 * Fix pyproject * Fix build constraint * Wip/cibuildwheel (#110) * Try to add cibuildwheel workflow * Configure cibuildwheel * Remove macos 14 * Fix workflow * Update cibuildwheel config * Try to fix archs commands * Fix config * Skip pypy * Add another failure repro decorator * Temporarily try increasing error tolerance * Try to add more debugging * Comment * Try to get cibuildwheel uploading to pypi
1 parent ec60745 commit a5bdba1

File tree

4 files changed

+143
-27
lines changed

4 files changed

+143
-27
lines changed

.github/workflows/cibuildwheel.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build_wheels:
10+
name: Build wheels on ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
# macos-13 is an intel runner, macos-14 is apple silicon
15+
os: [ubuntu-latest, windows-latest, macos-13]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Build wheels
21+
uses: pypa/[email protected]
22+
env:
23+
CIBW_SOME_OPTION: value
24+
with:
25+
package-dir: .
26+
output-dir: wheelhouse
27+
config-file: "{package}/pyproject.toml"
28+
29+
- uses: actions/upload-artifact@v4
30+
with:
31+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
32+
path: ./wheelhouse/*.whl
33+
34+
build_sdist:
35+
name: Build source distribution
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Build sdist
41+
run: pipx run build --sdist
42+
43+
- uses: actions/upload-artifact@v4
44+
with:
45+
name: cibw-sdist
46+
path: dist/*.tar.gz
47+
upload_pypi:
48+
needs: [build_wheels, build_sdist]
49+
runs-on: ubuntu-latest
50+
environment: pypi
51+
permissions:
52+
id-token: write
53+
if: github.event_name == 'release' && github.event.action == 'published'
54+
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
55+
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
56+
steps:
57+
- uses: actions/download-artifact@v4
58+
with:
59+
# unpacks all CIBW artifacts into dist/
60+
pattern: cibw-*
61+
path: dist
62+
merge-multiple: true
63+
64+
- uses: pypa/gh-action-pypi-publish@release/v1
65+
with:
66+
repository-url: https://test.pypi.org/legacy/

build-constraints.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
# build version constraints for use with wheelwright + multibuild
2-
numpy==1.15.0; python_version<='3.7' and platform_machine!='aarch64'
3-
numpy==1.19.2; python_version<='3.7' and platform_machine=='aarch64'
4-
numpy==1.17.3; python_version=='3.8' and platform_machine!='aarch64'
5-
numpy==1.19.2; python_version=='3.8' and platform_machine=='aarch64'
6-
numpy>=1.25.0; python_version>='3.9'
2+
numpy>=2.0.0; python_version>='3.9'

pyproject.toml

+50-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,58 @@
22
requires = [
33
"setuptools",
44
"cython>=0.25",
5-
"numpy>=1.15.0; python_version < '3.9'",
6-
"numpy>=1.25.0; python_version >= '3.9'",
5+
"numpy>=2.0.0,<3.0.0"
76
]
87
build-backend = "setuptools.build_meta"
98

10-
# NOTE: overrides here are only used if CIBW_ENVIRONMENT is not set
119
[tool.cibuildwheel]
12-
environment = { PIP_CONSTRAINT="build-constraints.txt" }
10+
build = "*"
11+
skip = "pp* cp36* cp37* cp38*"
12+
test-skip = ""
13+
free-threaded-support = false
1314

14-
[[tool.cibuildwheel.overrides]]
15-
select = "*-macosx_arm64"
16-
environment = { PIP_CONSTRAINT="build-constraints.txt", BLIS_COMPILER="clang -arch arm64" }
15+
archs = ["native"]
16+
17+
build-frontend = "default"
18+
config-settings = {}
19+
dependency-versions = "pinned"
20+
environment = {}
21+
environment-pass = []
22+
build-verbosity = 0
23+
24+
before-all = ""
25+
before-build = ""
26+
repair-wheel-command = ""
27+
28+
test-command = ""
29+
before-test = ""
30+
test-requires = []
31+
test-extras = []
32+
33+
container-engine = "docker"
34+
35+
manylinux-x86_64-image = "manylinux2014"
36+
manylinux-i686-image = "manylinux2014"
37+
manylinux-aarch64-image = "manylinux2014"
38+
manylinux-ppc64le-image = "manylinux2014"
39+
manylinux-s390x-image = "manylinux2014"
40+
manylinux-pypy_x86_64-image = "manylinux2014"
41+
manylinux-pypy_i686-image = "manylinux2014"
42+
manylinux-pypy_aarch64-image = "manylinux2014"
43+
44+
musllinux-x86_64-image = "musllinux_1_2"
45+
musllinux-i686-image = "musllinux_1_2"
46+
musllinux-aarch64-image = "musllinux_1_2"
47+
musllinux-ppc64le-image = "musllinux_1_2"
48+
musllinux-s390x-image = "musllinux_1_2"
49+
50+
51+
[tool.cibuildwheel.linux]
52+
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"
53+
54+
[tool.cibuildwheel.macos]
55+
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
56+
57+
[tool.cibuildwheel.windows]
58+
59+
[tool.cibuildwheel.pyodide]

tests/test_dotv.py

+26-15
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
from __future__ import division
22
from hypothesis import given, assume
3-
from math import sqrt, floor
3+
import numpy
44

55
from blis_tests_common import *
66
from blis.py import dotv
7-
from blis.cy import NO_CONJUGATE, CONJUGATE
87

98

109
@given(
11-
ndarrays(min_len=10, max_len=100,
12-
min_val=-100.0, max_val=100.0, dtype='float64'),
13-
ndarrays(min_len=10, max_len=100,
14-
min_val=-100.0, max_val=100.0, dtype='float64'),
10+
ndarrays(min_len=10, max_len=100, min_val=-100.0, max_val=100.0, dtype="float64"),
11+
ndarrays(min_len=10, max_len=100, min_val=-100.0, max_val=100.0, dtype="float64"),
1512
)
1613
def test_memoryview_double_noconj(A, B):
1714
if len(A) < len(B):
18-
B = B[:len(A)]
15+
B = B[: len(A)]
1916
else:
20-
A = A[:len(B)]
17+
A = A[: len(B)]
2118
assume(A is not None)
2219
assume(B is not None)
2320
numpy_result = A.dot(B)
@@ -26,18 +23,32 @@ def test_memoryview_double_noconj(A, B):
2623

2724

2825
@given(
29-
ndarrays(min_len=10, max_len=100,
30-
min_val=-100.0, max_val=100.0, dtype='float32'),
31-
ndarrays(min_len=10, max_len=100,
32-
min_val=-100.0, max_val=100.0, dtype='float32'),
26+
ndarrays(min_len=10, max_len=100, min_val=-100.0, max_val=100.0, dtype="float32"),
27+
ndarrays(min_len=10, max_len=100, min_val=-100.0, max_val=100.0, dtype="float32"),
3328
)
3429
def test_memoryview_float_noconj(A, B):
3530
if len(A) < len(B):
36-
B = B[:len(A)]
31+
B = B[: len(A)]
3732
else:
38-
A = A[:len(B)]
33+
A = A[: len(B)]
3934
assume(A is not None)
4035
assume(B is not None)
4136
numpy_result = A.dot(B)
4237
result = dotv(A, B)
43-
assert_allclose([numpy_result], result, atol=1e-3, rtol=1e-3)
38+
# We want to also know the true(r) answer, if one of them is off.
39+
A_float64 = A.astype(numpy.float64)
40+
B_float64 = B.astype(numpy.float64)
41+
numpy_result64 = A_float64.dot(B_float64)
42+
blis_result64 = dotv(A_float64, B_float64)
43+
try:
44+
assert_allclose(
45+
[numpy_result],
46+
result,
47+
atol=1e-3,
48+
rtol=1e-3,
49+
)
50+
except AssertionError as e:
51+
# Probably better to make a combined message, but eh
52+
print(f"Numpy 64bit result: {numpy_result64}")
53+
print(f"blis 64bit result: {blis_result64}")
54+
raise e

0 commit comments

Comments
 (0)