diff --git a/.github/workflows/python-qis-wheels.yml b/.github/workflows/python-qis-wheels.yml index c4800df76..34049ef8f 100644 --- a/.github/workflows/python-qis-wheels.yml +++ b/.github/workflows/python-qis-wheels.yml @@ -7,6 +7,10 @@ on: release: types: - published + pull_request: + # check builds work if qis-compiler build config changes + paths: + - 'qis-compiler/pyproject.toml' workflow_dispatch: permissions: @@ -95,6 +99,7 @@ jobs: contents: write # IMPORTANT: this permission is mandatory for trusted publishing id-token: write + if: ${{ github.event_name != 'pull_request' }} steps: # note: we can't use if: on the entire job, as if statements are evaluated # before matrix expansion, so we follow the convention of guppylang and diff --git a/qis-compiler/pyproject.toml b/qis-compiler/pyproject.toml index 5681d5f5e..1c7c9223f 100644 --- a/qis-compiler/pyproject.toml +++ b/qis-compiler/pyproject.toml @@ -5,10 +5,10 @@ build-backend = "maturin" [dependency-groups] dev = [ "guppylang~=0.21.0", + "pytest>=8.4.2", "pytest-snapshot~=0.9.0", "cibuildwheel>=2.23.2", - "pytket~=2.9", - "tket", + "tket-exts", # remove after next guppy-internals release ] [project] @@ -82,21 +82,17 @@ cache-keys = [ ] [tool.uv.sources] -tket = { workspace = true } -guppylang = { git = "https://github.com/cqcl/guppylang.git", rev = "025880d648d3", subdirectory = "guppylang" } +guppylang = { git = "https://github.com/cqcl/guppylang.git", rev = "d5b4ca6", subdirectory = "guppylang" } +tket-exts = { workspace = true } [tool.cibuildwheel] build = "cp310-*" +build-frontend = "build[uv]" skip = "*-win32 *-manylinux_i686 *-musllinux*" manylinux-x86_64-image = "manylinux_2_28" manylinux-aarch64-image = "manylinux_2_28" -test-requires = [ - "pytest", - "pytest-snapshot", - "guppylang @ git+https://github.com/cqcl/guppylang.git#subdirectory=guppylang@ts/borrow-arrays", - "pytket~=2.9.1", - "tket~=0.12.7", -] + +before-test = "uv sync --only-dev --active" test-command = "pytest -vv {package}" [tool.cibuildwheel.linux.environment] @@ -151,10 +147,11 @@ before-test = ''' # make sure the cache is readable by the host chmod -R a+rX /host/tmp/ci-cache/hugr-qis fi + uv sync --only-dev --active ''' repair-wheel-command = [ 'auditwheel repair -w {dest_dir} {wheel}', - 'pipx run abi3audit --strict --report {wheel}', + 'uvx abi3audit --strict --report {wheel}', ] [tool.cibuildwheel.macos.environment] @@ -171,7 +168,7 @@ before-all = [ ] repair-wheel-command = [ 'DYLD_LIBRARY_PATH=/tmp/llvm/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}', - 'pipx run abi3audit --strict --report {wheel}', + 'uvx abi3audit --strict --report {wheel}', ] [tool.cibuildwheel.windows.environment] @@ -183,8 +180,7 @@ before-all = [ 'curl -LO https://github.com/PLC-lang/llvm-package-windows/releases/download/v14.0.6/LLVM-14.0.6-win64.7z', '7z x LLVM-14.0.6-win64.7z "-oC:\LLVM" -y', ] -before-build = ['pip install delvewheel'] repair-wheel-command = [ - 'delvewheel repair -w {dest_dir} {wheel}', - 'pipx run abi3audit --strict --report {wheel}', + 'uvx delvewheel repair -w {dest_dir} {wheel}', + 'uvx abi3audit --strict --report {wheel}', ] diff --git a/qis-compiler/python/tests/test_basic_generation.py b/qis-compiler/python/tests/test_basic_generation.py index c4bf54aea..e7474ce2c 100644 --- a/qis-compiler/python/tests/test_basic_generation.py +++ b/qis-compiler/python/tests/test_basic_generation.py @@ -1,3 +1,6 @@ +import importlib +import importlib.util + import pytest from guppylang import guppy from guppylang.std.builtins import array, exit, panic, result @@ -18,7 +21,6 @@ ) from hugr.ops import CFG from pytest_snapshot.plugin import Snapshot -from pytket._tket.circuit import Circuit from selene_hugr_qis_compiler import HugrReadError, check_hugr, compile_to_llvm_ir triples = [ @@ -58,6 +60,9 @@ def foo() -> None: def test_unsupported_pytket_ops() -> None: """Test the check_hugr function to ensure it flags unsupported pytket ops.""" + if importlib.util.find_spec("tket") is None: + pytest.skip("tket not installed; skipping test of unsupported pytket ops") + from pytket._tket.circuit import Circuit # A pytket circuit with an unsupported op. circ = Circuit(2).CSXdg(0, 1) diff --git a/uv.lock b/uv.lock index 0c5b14c9c..5759cabb0 100644 --- a/uv.lock +++ b/uv.lock @@ -738,12 +738,11 @@ wheels = [ [[package]] name = "guppylang" version = "0.21.5" -source = { git = "https://github.com/cqcl/guppylang.git?subdirectory=guppylang&rev=025880d648d3#025880d648d3a22776514ad4403b4c46f29bd818" } +source = { git = "https://github.com/cqcl/guppylang.git?subdirectory=guppylang&rev=d5b4ca6#d5b4ca6186f87a958e33efe9e1447824607638dc" } dependencies = [ { name = "guppylang-internals" }, { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "numpy", version = "2.3.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "selene-hugr-qis-compiler" }, { name = "selene-sim" }, { name = "tqdm" }, { name = "types-tqdm" }, @@ -752,7 +751,7 @@ dependencies = [ [[package]] name = "guppylang-internals" version = "0.24.0" -source = { git = "https://github.com/cqcl/guppylang.git?subdirectory=guppylang-internals&rev=025880d648d3#025880d648d3a22776514ad4403b4c46f29bd818" } +source = { git = "https://github.com/cqcl/guppylang.git?subdirectory=guppylang-internals&rev=d5b4ca6#d5b4ca6186f87a958e33efe9e1447824607638dc" } dependencies = [ { name = "hugr" }, { name = "tket-exts" }, @@ -2604,9 +2603,9 @@ dev = [ { name = "cibuildwheel", version = "2.23.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "cibuildwheel", version = "3.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "guppylang" }, + { name = "pytest" }, { name = "pytest-snapshot" }, - { name = "pytket" }, - { name = "tket" }, + { name = "tket-exts" }, ] [package.metadata] @@ -2614,10 +2613,10 @@ dev = [ [package.metadata.requires-dev] dev = [ { name = "cibuildwheel", specifier = ">=2.23.2" }, - { name = "guppylang", git = "https://github.com/cqcl/guppylang.git?subdirectory=guppylang&rev=025880d648d3" }, + { name = "guppylang", git = "https://github.com/cqcl/guppylang.git?subdirectory=guppylang&rev=d5b4ca6" }, + { name = "pytest", specifier = ">=8.4.2" }, { name = "pytest-snapshot", specifier = "~=0.9.0" }, - { name = "pytket", specifier = "~=2.9" }, - { name = "tket", editable = "tket-py" }, + { name = "tket-exts", editable = "tket-exts" }, ] [[package]]