Skip to content

Commit 4bf5c72

Browse files
alugowskieriknw
andauthored
Update9.1.0 (#128)
* Update to SuiteSparse:GraphBLAS 9.1.0 * maybe fix? (path and extra constant) * Update default include path to include "suitesparse" * Try this * Maybe don't need this anymore for arm on mac os * Explicit macos x86 and arm runners * Add dir dump * Look in "/usr/local" * Try installing to prefix * Cmake from . * Add lib64 * Try installing to . instead of /tmp * Set MACOSX_DEPLOYMENT_TARGET * Try installing to /usr/local/graphblas * Try installing to {package} * Fix * Add prints * Add print * Try installing to . * parent * retry * Disable JIT on Windows * retry * Fix if * Revert to sys install * Fix sudo * Disable JIT on Windows * tweaks * MSVC complex values * Revert prints * Silence workflow warnings * Delete no longer used script * Undo run tests on push * Make linter happy * Linter * Support both suitesparse.sh and conda install paths * Fix cibw_test_skip typo * Build with numpy 2; add Python 3.13; drop Python 3.8 * Bump * Try setuptools<74 * experiment w/ setuptools as runtime dep * undo * Update cibuildwheel We need pypa/cibuildwheel#1915 to `yum install` * Use cibuildwheel 2.21, not 2.21.3 * Delete unnecessary code b/c we dropped Python 3.8 --------- Co-authored-by: Erik Welch <erik.n.welch@gmail.com>
1 parent 045d489 commit 4bf5c72

11 files changed

+783
-450
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
source: ["conda-forge"]
1919
# os: ["ubuntu-latest"]
2020
# source: ["source"]
21-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
21+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v4

.github/workflows/wheels.yml

+11-15
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,14 @@ jobs:
8484
cibw_skip: "pp* *musl*"
8585

8686
# macOS x86
87-
- os: macos-latest
87+
# Note: keep as old as possible as due to libomp this will be the oldest supported macOS version.
88+
- os: macos-12
8889
cibw_archs: "x86_64"
8990

90-
# macOS Apple Silicon cross-compiled on x86 macOS runner.
91-
# GitHub does not offer Apple Silicon yet (only for self-hosted).
92-
# See https://github.com/github/roadmap/issues/528
93-
- os: macos-latest
91+
# macOS Apple Silicon
92+
# Note: keep as old as possible as due to libomp this will be the oldest supported macOS version.
93+
- os: macos-14
9494
cibw_archs: "arm64"
95-
# Skip macOS ARM tests on Intel runner.
96-
cibw_test_skip: "*-macosx_arm64"
9795

9896
steps:
9997
- uses: actions/checkout@v4
@@ -139,17 +137,15 @@ jobs:
139137
if: contains(matrix.os, 'macos')
140138
# Install coreutils which includes `nproc` used by `make -j` in suitesparse.sh
141139
#
142-
# GitHub actions comes with libomp already installed, but for its native arch only. Must build universal one
143-
# manually so that both x86 and arm builds can be built.
140+
# Explicitly install libomp to be clear about the dependency.
141+
#
142+
# libomp determines the minimum macOS version that we can build for
144143
run: |
145144
brew fetch --retry coreutils && brew install coreutils
146-
brew fetch --retry libomp && brew install libomp
147-
if [[ ${{ matrix.cibw_archs }} == "arm64" ]] ; then
148-
echo "Building universal libomp manually"
149-
sh add_arm_to_libomp_dylib.sh || exit 1
150-
fi
145+
brew fetch --retry libomp && brew reinstall libomp
146+
echo MACOSX_DEPLOYMENT_TARGET=$(otool -l $(brew --prefix libomp)/lib/libomp.dylib | grep minos | awk '{print $2}') >> $GITHUB_ENV
151147
152-
- uses: pypa/cibuildwheel@v2.16
148+
- uses: pypa/cibuildwheel@v2.21
153149
with:
154150
output-dir: wheelhouse
155151
env:

.pre-commit-config.yaml

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ default_language_version:
99
python: python3
1010
repos:
1111
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v4.4.0
12+
rev: v5.0.0
1313
hooks:
1414
- id: check-added-large-files
1515
- id: check-ast
@@ -20,43 +20,43 @@ repos:
2020
- id: mixed-line-ending
2121
# - id: trailing-whitespace
2222
- repo: https://github.com/abravalheri/validate-pyproject
23-
rev: v0.14
23+
rev: v0.20.2
2424
hooks:
2525
- id: validate-pyproject
2626
name: Validate pyproject.toml
2727
- repo: https://github.com/PyCQA/autoflake
28-
rev: v2.2.1
28+
rev: v2.3.1
2929
hooks:
3030
- id: autoflake
3131
args: [--in-place]
3232
- repo: https://github.com/pycqa/isort
33-
rev: 5.12.0
33+
rev: 5.13.2
3434
hooks:
3535
- id: isort
3636
- repo: https://github.com/asottile/pyupgrade
37-
rev: v3.13.0
37+
rev: v3.18.0
3838
hooks:
3939
- id: pyupgrade
40-
args: [--py38-plus]
40+
args: [--py39-plus]
4141
# - repo: https://github.com/MarcoGorelli/auto-walrus
4242
# rev: v0.2.2
4343
# hooks:
4444
# - id: auto-walrus
4545
# args: [--line-length, "100"]
4646
- repo: https://github.com/psf/black
47-
rev: 23.9.1
47+
rev: 24.10.0
4848
hooks:
4949
- id: black
5050
# - id: black-jupyter
5151
- repo: https://github.com/PyCQA/flake8
52-
rev: 6.1.0
52+
rev: 7.1.1
5353
hooks:
5454
- id: flake8
5555
additional_dependencies: &flake8_dependencies
5656
# These versions need updated manually
57-
- flake8==6.1.0
58-
- flake8-comprehensions==3.14.0
59-
- flake8-bugbear==23.9.16
57+
- flake8==7.1.1
58+
- flake8-comprehensions==3.15.0
59+
- flake8-bugbear==24.8.19
6060
# - flake8-simplify==0.20.0
6161
- repo: https://github.com/asottile/yesqa
6262
rev: v1.5.0
@@ -71,6 +71,6 @@ repos:
7171
# - id: pyroma
7272
# args: [-n, "10", .]
7373
- repo: https://github.com/pre-commit/pre-commit-hooks
74-
rev: v4.4.0
74+
rev: v5.0.0
7575
hooks:
7676
- id: no-commit-to-branch # no commit directly to main

GB_VERSION.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.2.1
1+
9.1.0

add_arm_to_libomp_dylib.sh

-53
This file was deleted.

build_graphblas_cffi.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,30 @@
1414
# Expected subdirectories: include/ (contains GraphBLAS.h), lib/, and bin/ (on Windows only)
1515
# Otherwise fallback to default system folders.
1616
graphblas_root = os.environ.get("GraphBLAS_ROOT", None)
17+
1718
if not graphblas_root:
1819
# Windows wheels.yml configures suitesparse.sh to install GraphBLAS to "C:\\GraphBLAS".
19-
graphblas_root = "C:\\GraphBLAS" if is_win else sys.prefix
20-
21-
include_dirs = [os.path.join(graphblas_root, "include")]
22-
library_dirs = [os.path.join(graphblas_root, "lib")]
20+
if is_win:
21+
graphblas_root = "C:\\GraphBLAS"
22+
elif Path("/usr/local/include/suitesparse").exists():
23+
# SuiteSparse:GraphBLAS 9.1+ built by suitesparse.sh
24+
graphblas_root = "/usr/local"
25+
else:
26+
# Conda install
27+
graphblas_root = sys.prefix
28+
29+
include_dirs = [
30+
os.path.join(graphblas_root, "include"),
31+
os.path.join(graphblas_root, "include", "suitesparse"),
32+
]
33+
library_dirs = [os.path.join(graphblas_root, "lib"), os.path.join(graphblas_root, "lib64")]
2334
if is_win:
2435
include_dirs.append(os.path.join(sys.prefix, "Library", "include"))
36+
include_dirs.append(os.path.join(sys.prefix, "Library", "include", "suitesparse"))
2537
library_dirs.append(os.path.join(sys.prefix, "Library", "lib"))
2638

2739
include_dirs.append(os.path.join(graphblas_root, "include"))
40+
include_dirs.append(os.path.join(graphblas_root, "include", "suitesparse"))
2841
library_dirs.append(os.path.join(graphblas_root, "lib"))
2942
library_dirs.append(os.path.join(graphblas_root, "bin"))
3043

@@ -68,6 +81,9 @@ def get_extension(apply_msvc_patch: bool = None, extra_compile_args=()):
6881
msvc_code = msvc_code.replace("double _Complex", "_Dcomplex")
6982
code_path.write_text(msvc_code)
7083

84+
# Hack: tell GraphBLAS.h that we need MSVC-style complex values
85+
extra_compile_args = list(extra_compile_args) + ["-DGxB_HAVE_COMPLEX_MSVC"]
86+
7187
return Extension(
7288
"suitesparse_graphblas._graphblas",
7389
[os.path.join("suitesparse_graphblas", "_graphblas.c")],

pyproject.toml

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
[build-system]
22
build-backend = "setuptools.build_meta"
33
requires = [
4-
"setuptools >=64",
4+
# setuptools<74 until PyPy vendors cffi 1.15.1
5+
"setuptools >=64, <74",
56
"setuptools-git-versioning",
67
"wheel",
78
"cffi>=1.11",
89
"cython",
9-
"oldest-supported-numpy; platform_python_implementation != 'PyPy'",
10-
# Inspired by SciPy: unpin numpy version for PyPy builds,
11-
# as oldest-supported-numpy does not take PyPy into account.
12-
"numpy; platform_python_implementation=='PyPy'",
10+
"numpy>=2.0",
1311
]
1412

1513
[project]
1614
name = "suitesparse-graphblas"
1715
dynamic = ["version"]
1816
description = "SuiteSparse:GraphBLAS Python bindings."
1917
readme = "README.md"
20-
requires-python = ">=3.8"
18+
requires-python = ">=3.9"
2119
license = {file = "LICENSE"}
2220
authors = [
2321
{name = "Erik Welch", email = "erik.n.welch@gmail.com"},
@@ -53,11 +51,11 @@ classifiers = [
5351
"Operating System :: Microsoft :: Windows",
5452
"Programming Language :: Python",
5553
"Programming Language :: Python :: 3",
56-
"Programming Language :: Python :: 3.8",
5754
"Programming Language :: Python :: 3.9",
5855
"Programming Language :: Python :: 3.10",
5956
"Programming Language :: Python :: 3.11",
6057
"Programming Language :: Python :: 3.12",
58+
"Programming Language :: Python :: 3.13",
6159
"Programming Language :: Python :: 3 :: Only",
6260
"Intended Audience :: Developers",
6361
"Intended Audience :: Other Audience",
@@ -68,9 +66,8 @@ classifiers = [
6866
"Topic :: Software Development :: Libraries :: Python Modules",
6967
]
7068
dependencies = [
71-
# These are super-old; can/should we update them?
72-
"cffi>=1.11",
73-
"numpy>=1.19",
69+
"cffi>=1.15",
70+
"numpy>=1.23",
7471
]
7572
[project.urls]
7673
homepage = "https://github.com/GraphBLAS/python-suitesparse-graphblas"
@@ -96,7 +93,7 @@ dirty_template = "{tag}+{ccount}.g{sha}.dirty"
9693

9794
[tool.black]
9895
line-length = 100
99-
target-version = ["py38", "py39", "py310", "py311"]
96+
target-version = ["py39", "py310", "py311", "py312", "py313"]
10097

10198
[tool.isort]
10299
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]

suitesparse.sh

+22-4
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,29 @@ if [ -n "${SUITESPARSE_FASTEST_BUILD}" ]; then
113113
cmake_params+=(-DCMAKE_CUDA_DEV=1)
114114
fi
115115

116-
# Use `-DJITINIT=2` so that the JIT functionality is available, but disabled by default.
117-
# Level 2, "run", means that pre-JIT kernels may be used, which does not require a compiler at runtime.
118-
cmake .. -DJITINIT=2 -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles' "${cmake_params[@]}"
116+
if [ -n "${CMAKE_GNUtoMS}" ]; then
117+
# Windows options
118+
echo "Skipping JIT on Windows for now because it fails to build."
119+
cmake_params+=(-DGRAPHBLAS_USE_JIT=OFF)
120+
else
121+
# Use `-DJITINIT=2` so that the JIT functionality is available, but disabled by default.
122+
# Level 2, "run", means that pre-JIT kernels may be used, which does not require a compiler at runtime.
123+
cmake_params+=(-DJITINIT=2)
124+
125+
# Disable JIT here too to not segfault in tests
126+
cmake_params+=(-DGRAPHBLAS_USE_JIT=OFF)
127+
fi
128+
129+
# some platforms require sudo for installation, some don't have sudo at all
130+
if [ "$(uname)" == "Darwin" ]; then
131+
SUDO=sudo
132+
else
133+
SUDO=""
134+
fi
135+
136+
cmake .. -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles' "${cmake_params[@]}"
119137
make -j$NPROC
120-
make install
138+
$SUDO make install
121139

122140
if [ -n "${CMAKE_GNUtoMS}" ]; then
123141
if [ -z "${GRAPHBLAS_PREFIX}" ]; then

suitesparse_graphblas/create_headers.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Run `python create_headers.py --help` to see more help.
2222
2323
"""
24+
2425
import argparse
2526
import os
2627
import re
@@ -325,6 +326,7 @@ def groupby(index, seq):
325326
"RMM_WRAP_H",
326327
"GXB_COMPLEX_H",
327328
"GxB_STATIC_INLINE_VOID",
329+
"GxB_HAVE_COMPLEX_C99",
328330
# deprecated
329331
"GxB_HYPER",
330332
}
@@ -633,6 +635,7 @@ def handle_function_node(node):
633635
"init": "core",
634636
"wait": "core",
635637
"deserialize": "core",
638+
"Serialized": "core", # Added in version 9
636639
}[group]
637640
return {
638641
"name": node.name,
@@ -782,7 +785,7 @@ def main():
782785
parser.add_argument(
783786
"--graphblas",
784787
help="Path to GraphBLAS.h of SuiteSparse. Default will look in Python prefix path.",
785-
default=os.path.join(sys.prefix, "include", "GraphBLAS.h"),
788+
default=os.path.join(sys.prefix, "include", "suitesparse", "GraphBLAS.h"),
786789
)
787790
parser.add_argument(
788791
"--show-skipped",

0 commit comments

Comments
 (0)