Skip to content

Commit

Permalink
Add 3.12 to action without cython support
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Giguere committed Jan 15, 2024
1 parent 7a883d3 commit d629ee1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
# Set up wheels matrix. This is CPython 3.6--3.11 for all OS targets.
CIBW_BUILD: "cp3{6,7,8,9,10,11}-*"
# Set up wheels matrix. This is CPython 3.6--3.12 for all OS targets.
CIBW_BUILD: "cp3{6,7,8,9,10,11,12}-*"
# Numpy and SciPy do not supply wheels for i686 or win32 for
# Python 3.10+, so we skip those:
CIBW_SKIP: "*-musllinux* cp3{8,9,10,11}-manylinux_i686 cp3{8,9,10,11}-win32"
CIBW_SKIP: "*-musllinux* cp3{8,9,10,11,12}-manylinux_i686 cp3{8,9,10,11,12}-win32"
OVERRIDE_VERSION: ${{ github.event.inputs.override_version }}

steps:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ jobs:
python-version: "3.10"
pytest-extra-options: "-W ignore::ImportWarning -k 'not (test_correlation or test_interpolate or test_mcsolve)'"

# Builds without Cython at runtime. This is a core feature;
# everything should be able to run this.
- case-name: Python 3.12
os: ubuntu-latest
python-version: "3.12"

steps:
- uses: actions/checkout@v3

Expand Down
8 changes: 7 additions & 1 deletion qutip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,30 @@
pass
else:
from qutip.utilities import _version2int
import sys
_cy_require = "0.29.20"
_cy_unsupported = "3.0.0"
if _version2int(_Cython.__version__) < _version2int(_cy_require):
warnings.warn(
"Old version of Cython detected: needed {}, got {}."
.format(_cy_require, _Cython.__version__)
)
if _version2int(_Cython.__version__) >= _version2int(_cy_unsupported):
elif _version2int(_Cython.__version__) >= _version2int(_cy_unsupported):
warnings.warn(
"The new version of Cython, (>= 3.0.0) is not supported."
.format(_Cython.__version__)
)
elif _version2int(_Cython.__version__.split()[0]) >= _version2int("3.12.0"):
warnings.warn(
"Runtime cython compilation does not work on Python 3.12."
)
else:
# Setup pyximport
import qutip.cy.pyxbuilder as _pyxbuilder
_pyxbuilder.install()
del _pyxbuilder, _Cython, _version2int
qutip.settings.has_cython = True
del sys


# -----------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions qutip/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def _skip_cython_tests_if_unavailable(item):
# importorskip does not have maxversion
if _version2int(_Cython.__version__) >= _version2int("3.0.0"):
pytest.skip("cython 3.0.0 not supported")
return
import qutip
if not qutip.settings.has_cython:
pytest.skip("Cython not available at runtime.")


@pytest.hookimpl(trylast=True)
Expand Down

0 comments on commit d629ee1

Please sign in to comment.