Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ for more details.
.. code-block:: bash

pip install --group dev --group blas
pip install --editable . \
FORCE_PKGCONF_PYPI=1 pip install --editable . \
--no-build-isolation \
--config-settings=editable-verbose=true \
--config-settings=setup-args="-Dblas=enabled"
Expand Down
33 changes: 0 additions & 33 deletions dwave/optimization/_build/_find_openblas.py

This file was deleted.

30 changes: 6 additions & 24 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,12 @@ dwave_optimization_dependencies = []
# Set up BLAS. _find_openblas.py will return the include directory, the library
# directory and the library name.
if not get_option('blas').disabled()
blasinfo = run_command(
['dwave/optimization/_build/_find_openblas.py'],
capture: true,
check: true
).stdout().splitlines()
if blasinfo.length() != 0
assert(blasinfo.length() == 3, '_find_openblas.py returned an unexpected value')

dwave_optimization_dependencies += [
declare_dependency(
dependencies: cpp.find_library(
blasinfo[2],
dirs: blasinfo[1],
required: true,
),
include_directories: blasinfo[0],
)
]
elif get_option('blas').enabled()
error(
'No BLAS available.' +
'Install scipy_openblas64 into the build environment or disable the blas user option'
)
endif
blas = dependency(
'scipy-openblas',
method: 'pkg-config',
required: get_option('blas').enabled(),
)
dwave_optimization_dependencies += [blas]
endif

if host_machine.system() == 'windows'
Expand Down
50 changes: 24 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Documentation = "https://docs.dwavequantum.com"
[dependency-groups]
blas = [
# Optional build requirement, last refreshed April 2026
"pkgconf==2.5.1.post2",
"scipy_openblas64==0.3.31.188.0",
]
build = [
Expand Down Expand Up @@ -93,20 +94,18 @@ test = [

[tool.cibuildwheel]
build-verbosity = "1"
skip = "pp* *musllinux*"
skip = "*musllinux*"

# When building with cibuildwheel, we want scipy_openblas64 available to the
# build step. There isn't (as of Dec 2025) a way to override the
# build-system.requires so we need to build without isolation
before-build = "pip install --group blas-build"
before-build = "pip install --group build"
build-frontend = { name = "build", args = ["--no-isolation"] }

# Customize the test running by installing our test requirements and by turning
# on -Werror
before-test = "pip install --group test"
test-command = "python -Werror -m unittest discover {project}/tests/"

[tool.cibuildwheel.config-settings]
compile-args = ["-v"]
setup-args = ["-Dblas=enabled"] # require BLAS

[tool.cibuildwheel.linux]
archs = "x86_64 aarch64"
Expand All @@ -115,11 +114,11 @@ archs = "x86_64 aarch64"
# We follow NumPy and don't build universal wheels, see https://github.com/numpy/numpy/pull/20787
archs = "x86_64 arm64"

# Lowest version that has the C++ features we want, see https://cibuildwheel.pypa.io/en/stable/cpp_standards/
environment = "MACOSX_DEPLOYMENT_TARGET=10.13"
environment = { MACOSX_DEPLOYMENT_TARGET = "10.13" }

[tool.cibuildwheel.windows]
archs = "AMD64"

repair-wheel-command = [
"pip install delvewheel",
# We put the commands in an .sh so we can use bash
Expand All @@ -130,34 +129,33 @@ repair-wheel-command = [
# For Python3.12+, rather than building individual wheels we build an abi3
# wheel. 313t and 314t do not support abi wheels yet.
select = "cp31[!01]-*" # uses fnmatch, will fail for 3.20+ but good enough for now
build-frontend = { name = "build", args = ["-Csetup-args=-Dpython.allow_limited_api=true", "--no-isolation"] }

inherit.config-settings = "append"
config-settings = { "setup-args" = ["-Dpython.allow_limited_api=true"] }

inherit.repair-wheel-command = "append"
repair-wheel-command = [
"pip install abi3audit",
"abi3audit --strict --report {wheel}",
]

[[tool.cibuildwheel.overrides]]
select = "*-????linux_*"
inherit.repair-wheel-command = "prepend"
repair-wheel-command = "python /project/dwave/optimization/_build/_fix_rpath.py {wheel}"
# For everything we build except macosx_x86_64, we want to include scipy-openblas
select = "*-{????linux_*,macosx_arm64,win_*}"

[[tool.cibuildwheel.overrides]]
select = "*-macosx_*"
inherit.repair-wheel-command = "prepend"
repair-wheel-command = "python ./dwave/optimization/_build/_fix_rpath.py {wheel}"
inherit.environent = "append"
environment = { FORCE_PKGCONF_PYPI = "1" }

inherit.before-build = "append"
before-build = "pip install --group blas"

inhert.test-command = "append"
test-command = "python -c \"from dwave.optimization.symbols import MatrixMultiply; assert(MatrixMultiply.implementation() == 'blas')\""

[[tool.cibuildwheel.overrides]]
# We need a universal build of scipy_openblas so we need to make one on the fly
select = "*-macosx_*"
before-build = [
"pip download --group blas -d .openblas_arm64 --platform macosx_11_0_arm64 --no-deps",
"pip download --group blas -d .openblas_x86_64 --platform macosx_11_0_x86_64 --no-deps",
"pip install delocate",
"delocate-merge .openblas_x86_64/scipy_openblas*.whl .openblas_arm64/scipy_openblas*.whl -w .openblas",
"pip install .openblas/scipy_openblas*.whl",
"pip install --group build",
]
select = "*-{????linux,macosx}_*"
inherit.repair-wheel-command = "prepend"
repair-wheel-command = "python {project}/dwave/optimization/_build/_fix_rpath.py {wheel}"

[tool.coverage.run]
source = ["dwave/optimization"]
Expand Down