diff --git a/.dep-versions b/.dep-versions index 68d7b6becf..8a7fa0067f 100644 --- a/.dep-versions +++ b/.dep-versions @@ -8,7 +8,7 @@ enzyme=v0.0.149 # For a custom PL version, update the package version here and at # 'doc/requirements.txt -pennylane=0.39.0.dev16 +pennylane=0.39.0.dev26 # For a custom LQ/LK version, update the package version here and at # 'doc/requirements.txt'. Also, update the 'LIGHTNING_GIT_TAG' at diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 61235d045a..ca53784eb1 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -222,6 +222,9 @@

Internal changes

+* Remove deprecated pennylane code across the frontend. + [(#1168)](https://github.com/PennyLaneAI/catalyst/pull/1168) + * Update Enzyme to version `v0.0.149`. [(#1142)](https://github.com/PennyLaneAI/catalyst/pull/1142) diff --git a/doc/requirements.txt b/doc/requirements.txt index ad23637061..84ebcabd5e 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -32,4 +32,4 @@ lxml_html_clean --extra-index-url https://test.pypi.org/simple/ pennylane-lightning-kokkos==0.38.0 pennylane-lightning==0.38.0 -pennylane==0.39.0.dev16 +pennylane==0.39.0.dev26 diff --git a/frontend/catalyst/device/qjit_device.py b/frontend/catalyst/device/qjit_device.py index c97cce0e5a..99cf6a4e04 100644 --- a/frontend/catalyst/device/qjit_device.py +++ b/frontend/catalyst/device/qjit_device.py @@ -149,7 +149,9 @@ class BackendInfo: # pylint: disable=too-many-branches @debug_logger -def extract_backend_info(device: qml.QubitDevice, capabilities: DeviceCapabilities) -> BackendInfo: +def extract_backend_info( + device: qml.devices.QubitDevice, capabilities: DeviceCapabilities +) -> BackendInfo: """Extract the backend info from a quantum device. The device is expected to carry a reference to a valid TOML config file.""" @@ -472,7 +474,7 @@ def get_device_toml_config(device) -> TOMLDocument: # The expected case: device specifies its own config. toml_file = device.config else: - # TODO: Remove this section when `qml.Device`s are guaranteed to have their own config file + # TODO: Remove this section when `qml.devices.Device`s are guaranteed to have their own config file # field. device_lpath = pathlib.Path(get_lib_path("runtime", "RUNTIME_LIB_DIR")) diff --git a/frontend/catalyst/jax_tracer.py b/frontend/catalyst/jax_tracer.py index 330d416a87..0847a31f7f 100644 --- a/frontend/catalyst/jax_tracer.py +++ b/frontend/catalyst/jax_tracer.py @@ -25,7 +25,8 @@ import jax import jax.numpy as jnp import pennylane as qml -from pennylane import QubitDevice, QubitUnitary, QueuingManager +from pennylane import QubitUnitary, QueuingManager +from pennylane.devices import QubitDevice from pennylane.measurements import DensityMatrixMP, MeasurementProcess, StateMP from pennylane.operation import AnyWires, Operation, Operator, Wires from pennylane.ops import Adjoint, Controlled, ControlledOp diff --git a/frontend/catalyst/third_party/cuda/__init__.py b/frontend/catalyst/third_party/cuda/__init__.py index 8fedc0ccff..f2aa65e9f0 100644 --- a/frontend/catalyst/third_party/cuda/__init__.py +++ b/frontend/catalyst/third_party/cuda/__init__.py @@ -96,7 +96,7 @@ def wrap_fn(fn): # Do we need to reimplement apply for every child? -class BaseCudaInstructionSet(qml.QubitDevice): +class BaseCudaInstructionSet(qml.devices.QubitDevice): """Base instruction set for CUDA-Quantum devices""" pennylane_requires = ">=0.34" diff --git a/frontend/test/pytest/test_braket_local_devices.py b/frontend/test/pytest/test_braket_local_devices.py index 6297426c25..8dd4ddd154 100644 --- a/frontend/test/pytest/test_braket_local_devices.py +++ b/frontend/test/pytest/test_braket_local_devices.py @@ -23,7 +23,7 @@ try: qml.device("braket.local.qubit", backend="default", wires=1) -except qml._device.DeviceError: +except qml.DeviceError: pytest.skip( "skipping Braket local tests because ``amazon-braket-pennylane-plugin`` is not installed", allow_module_level=True, diff --git a/frontend/test/pytest/test_config_functions.py b/frontend/test/pytest/test_config_functions.py index 503284650e..ea81b95a41 100644 --- a/frontend/test/pytest/test_config_functions.py +++ b/frontend/test/pytest/test_config_functions.py @@ -32,7 +32,7 @@ ) -class DeviceToBeTested(qml.QubitDevice): +class DeviceToBeTested(qml.devices.QubitDevice): """Test device""" name = "Dummy Device" diff --git a/frontend/test/pytest/test_custom_devices.py b/frontend/test/pytest/test_custom_devices.py index 9fca66345c..f3b2e47956 100644 --- a/frontend/test/pytest/test_custom_devices.py +++ b/frontend/test/pytest/test_custom_devices.py @@ -133,7 +133,7 @@ def test_custom_device_load(): """Test that custom device can run using Catalyst.""" - class DummyDevice(qml.QubitDevice): + class DummyDevice(qml.devices.QubitDevice): """Dummy Device""" name = "Dummy Device" @@ -184,7 +184,7 @@ def f(): def test_custom_device_bad_directory(): """Test that custom device error.""" - class DummyDevice(qml.QubitDevice): + class DummyDevice(qml.devices.QubitDevice): """Dummy Device""" name = "Dummy Device" @@ -224,7 +224,7 @@ def f(): def test_custom_device_no_c_interface(): """Test that custom device error.""" - class DummyDevice(qml.QubitDevice): + class DummyDevice(qml.devices.QubitDevice): """Dummy Device""" name = "Dummy Device" diff --git a/frontend/test/pytest/test_template.py b/frontend/test/pytest/test_template.py index 81f62a4378..a2c3200f00 100644 --- a/frontend/test/pytest/test_template.py +++ b/frontend/test/pytest/test_template.py @@ -157,6 +157,7 @@ def basic_entangler_layers(weights): assert np.allclose(interpreted_fn(params), jitted_fn(params)) +@pytest.mark.filterwarnings("ignore::pennylane.PennyLaneDeprecationWarning") def test_basis_state_preparation(backend): """Test basis state preparation.""" @@ -508,6 +509,7 @@ def flip_sign(): assert np.allclose(jitted_fn(), interpreted_fn()) +@pytest.mark.filterwarnings("ignore:qml.broadcast:pennylane.PennyLaneDeprecationWarning") def test_broadcast_single(backend): """Test broadcast single.""" @@ -522,6 +524,7 @@ def broadcast_single(pars): assert np.allclose(jitted_fn(params), interpreted_fn(params)) +@pytest.mark.filterwarnings("ignore:qml.broadcast:pennylane.PennyLaneDeprecationWarning") def test_broadcast_double(backend): """Test broadcast double.""" @@ -536,6 +539,7 @@ def broadcast_double(pars): assert np.allclose(jitted_fn(params), interpreted_fn(params)) +@pytest.mark.filterwarnings("ignore:qml.broadcast:pennylane.PennyLaneDeprecationWarning") def test_broadcast_chain(backend): """Test broadcast chain.""" @@ -550,6 +554,7 @@ def broadcast_chain(pars): assert np.allclose(jitted_fn(params), interpreted_fn(params)) +@pytest.mark.filterwarnings("ignore:qml.broadcast:pennylane.PennyLaneDeprecationWarning") def test_broadcast_ring(backend): """Test broadcast ring.""" @@ -564,6 +569,7 @@ def broadcast_ring(pars): assert np.allclose(jitted_fn(params), interpreted_fn(params)) +@pytest.mark.filterwarnings("ignore:qml.broadcast:pennylane.PennyLaneDeprecationWarning") def test_broadcast_pyramid(backend): """Test broadcast pyramid.""" @@ -578,6 +584,7 @@ def broadcast_pyramid(pars): assert np.allclose(jitted_fn(params), interpreted_fn(params)) +@pytest.mark.filterwarnings("ignore:qml.broadcast:pennylane.PennyLaneDeprecationWarning") def test_broadcast_all_to_all(backend): """Test broadcast all to all."""