Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate qiskit.providers.models #12788

Closed
wants to merge 172 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
9cc2154
initial commit
1ucian0 Jun 7, 2024
6d8ac97
reno
1ucian0 Jun 21, 2024
5906c3b
Apply suggestions from code review
1ucian0 Jun 21, 2024
2e99d5a
deprecate qobj and assemble
1ucian0 Jun 24, 2024
76e6dd5
reno
1ucian0 Jun 24, 2024
a3610f5
first attempt on Fake1QV2
1ucian0 Jun 25, 2024
7c79309
deprecate Fake1Q
1ucian0 Jun 25, 2024
a5a6d72
Fake1QV2 should not have two-qubit gates
1ucian0 Jun 25, 2024
70113d0
test.python.circuit.test_parameters.TestParameters
1ucian0 Jun 25, 2024
ca7eba8
test.python.providers.fake_provider.test_fake_backends.FakeBackendsTest
1ucian0 Jun 25, 2024
43cfcb0
test.python.providers.test_fake_backends.TestFakeBackends
1ucian0 Jun 25, 2024
535f133
test.python.result.test_mitigators
1ucian0 Jun 25, 2024
7a265bb
test.python.transpiler.test_preset_passmanagers
1ucian0 Jun 25, 2024
eea59aa
test.python.transpiler.test_target
1ucian0 Jun 25, 2024
b2ed530
test.python.transpiler.test_unitary_synthesis
1ucian0 Jun 25, 2024
8cabdc1
test.python.transpiler.test_vf2_layout
1ucian0 Jun 25, 2024
52f950c
test.python.transpiler.test_vf2_post_layout
1ucian0 Jun 25, 2024
1659bab
test/python/visualization/test_circuit_latex
1ucian0 Jun 25, 2024
9dc496a
test.python.transpiler.test_sabre_layout
1ucian0 Jun 25, 2024
3bafa47
test.python.transpiler.test_sabre_layout
1ucian0 Jun 25, 2024
429718e
test.python.transpiler.test_pulse_gate_pass
1ucian0 Jun 25, 2024
8498188
test.python.scheduler.test_basic_scheduler.TestBasicSchedule
1ucian0 Jun 25, 2024
6c20149
test.python.pulse.test_transforms
1ucian0 Jun 25, 2024
1fb7833
test.python.pulse.test_schedule
1ucian0 Jun 25, 2024
c800414
test.python.pulse.test_macros
1ucian0 Jun 25, 2024
da77a15
test.python.pulse.test_instruction_schedule_map
1ucian0 Jun 25, 2024
40e2e69
test.python.pulse.test_block
1ucian0 Jun 25, 2024
ddef320
test.python.circuit.test_scheduled_circuit
1ucian0 Jun 25, 2024
847b920
test.python.transpiler.test_calibrationbuilder
1ucian0 Jun 26, 2024
2a9cbe8
test.python.providers.test_backendconfiguration
1ucian0 Jun 26, 2024
783b426
test.python.compiler.test_transpiler
1ucian0 Jun 26, 2024
798d06b
test.python.transpiler.test_passmanager_run
1ucian0 Jun 26, 2024
77bf474
test.python.transpiler.test_passmanager_config.TestPassManagerConfig.…
1ucian0 Jun 26, 2024
5dfacd3
test.python.transpiler.test_passmanager_config
1ucian0 Jun 26, 2024
d892be3
test.python.primitives.test_backend_estimator.TestBackendEstimator
1ucian0 Jun 26, 2024
2170a97
test.python.circuit.test_scheduled_circuit.TestScheduledCircuit.test_…
1ucian0 Jun 26, 2024
a21ee82
test.python.circuit.test_scheduled_circuit
1ucian0 Jun 26, 2024
21540a5
test.python.transpiler.test_vf2_layout
1ucian0 Jun 26, 2024
b57241c
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jun 27, 2024
a398425
shallow deprecation of assemble
1ucian0 Jun 27, 2024
6d96cc8
test.python.compiler.test_disassembler
1ucian0 Jun 27, 2024
e0a3999
fakebackend pulse
1ucian0 Jun 28, 2024
79f67c2
test.python.circuit.test_parameters
1ucian0 Jun 28, 2024
66c6490
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jun 28, 2024
2bba185
PulseQobjInstruction is used by GenericBackendV2
1ucian0 Jun 28, 2024
b809ace
test.python.scheduler.test_basic_scheduler
1ucian0 Jun 28, 2024
e5c5b43
test.python.result.test_result
1ucian0 Jun 28, 2024
7edd883
test.python.pulse.test_calibration_entries
1ucian0 Jun 28, 2024
b5e8b28
test.python.compiler.test_assembler
1ucian0 Jun 28, 2024
a2ee3b3
test.python.transpiler.test_star_prerouting
1ucian0 Jul 1, 2024
8a56629
test.python.pulse.test_instruction_schedule_map
1ucian0 Jul 1, 2024
249ccb7
test.python.providers.basic_provider.test_basic_simulator
1ucian0 Jul 1, 2024
e48d295
test.python.primitives.test_backend_sampler_v2
1ucian0 Jul 1, 2024
50a350a
test.python.compiler.test_disassembler
1ucian0 Jul 1, 2024
fefb294
test.python.compiler.test_compiler
1ucian0 Jul 1, 2024
da38a72
test.python.circuit.test_scheduled_circuit
1ucian0 Jul 1, 2024
a418008
test.python.providers.test_fake_backends
1ucian0 Jul 1, 2024
a3f0c79
test.python.circuit.test_unitary
1ucian0 Jul 1, 2024
2c99f28
test.python.transpiler.test_sabre_swap
1ucian0 Jul 1, 2024
5124403
test.python.providers.fake_provider.test_fake_backends
1ucian0 Jul 1, 2024
884d394
Aer using Provider ABC
1ucian0 Jul 1, 2024
ada3d38
aer warnings
1ucian0 Jul 2, 2024
593fabb
reno
1ucian0 Jul 2, 2024
1d781b0
another pass on reno
1ucian0 Jul 3, 2024
621e72a
test.python.pulse
1ucian0 Jul 3, 2024
3898c77
test.python.compiler.test_compiler
1ucian0 Jul 3, 2024
c2f2fdb
add module to fiterwarning
1ucian0 Jul 3, 2024
73dd5af
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 4, 2024
82032bc
test.python.compiler.test_transpiler
1ucian0 Jul 4, 2024
963b1ae
fixing obscure expcetion handleing for comparison
1ucian0 Jul 4, 2024
2ebd949
conflicts
1ucian0 Jul 9, 2024
4c7fc59
Merge branch 'main' of github.com:Qiskit/qiskit-terra into fake_provi…
1ucian0 Jul 11, 2024
8f6714d
test.python.transpiler.test_stochastic_swap test.python.transpiler.te…
1ucian0 Jul 11, 2024
a921073
test.python.transpiler.test_echo_rzx_weyl_decomposition
1ucian0 Jul 11, 2024
31a03e1
test.python.transpiler.test_instruction_durations
1ucian0 Jul 11, 2024
226a98b
test.python.providers.test_backendproperties
1ucian0 Jul 11, 2024
9dc293b
test.python.qpy.test_circuit_load_from_qpy
1ucian0 Jul 11, 2024
c20b11b
test.python.providers.test_pulse_defaults
1ucian0 Jul 12, 2024
283471b
test.python.primitives.test_backend_sampler_v2
1ucian0 Jul 12, 2024
5ec7f9f
test.python.primitives.test_backend_sampler
1ucian0 Jul 12, 2024
dc8f237
test.python.compiler.test_scheduler
1ucian0 Jul 12, 2024
df530ca
test/python/compiler/test_scheduler.py
1ucian0 Jul 12, 2024
105848f
test.python.compiler.test_disassembler
1ucian0 Jul 12, 2024
386d893
test.python.compiler.test_assembler
1ucian0 Jul 12, 2024
0ce73df
test.python.compiler.test_sequencer
1ucian0 Jul 12, 2024
3db79f9
test.python.compiler.test_transpiler
1ucian0 Jul 12, 2024
f1a6490
test.python.primitives.test_primitive
1ucian0 Jul 17, 2024
e6bae24
Merge branch 'main' of github.com:Qiskit/qiskit-terra into fake_provi…
1ucian0 Jul 17, 2024
fcc7db4
better depreaction handleling from Aer
1ucian0 Jul 17, 2024
56a401a
test.python.primitives.test_backend_estimator_v2
1ucian0 Jul 17, 2024
4d08cea
test.python.compiler.test_compiler
1ucian0 Jul 17, 2024
1fbb30f
ignore warnings, because the output is otherwise very verbose
1ucian0 Jul 17, 2024
6743992
ignore to avoid fludding the CI log
1ucian0 Jul 18, 2024
4492c62
seeding all GenericBackendV2
1ucian0 Jul 18, 2024
6cbf167
test.python.visualization.test_gate_map
1ucian0 Jul 18, 2024
2c88395
deprecation warnings: once
1ucian0 Jul 18, 2024
ce72692
default
1ucian0 Jul 18, 2024
365da09
default
1ucian0 Jul 18, 2024
26ba948
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 18, 2024
6142fca
Merge branch 'fake_provider/backendV2/1' into deprecate/backendv1
1ucian0 Jul 18, 2024
3b233d9
Merge branch 'main' of github.com:Qiskit/qiskit-terra into fake_provi…
1ucian0 Jul 18, 2024
330b180
BackendConfiguration
1ucian0 Jul 18, 2024
5da8083
PulseBackendConfiguration
1ucian0 Jul 18, 2024
19e86e0
QasmBackendConfiguration
1ucian0 Jul 18, 2024
9d77fe1
QasmBackendConfiguration and adjust stacklevel
1ucian0 Jul 18, 2024
35ef95f
UchannelLO
1ucian0 Jul 18, 2024
1ef62b4
GateConfig
1ucian0 Jul 18, 2024
9097bc9
test.python.providers.test_fake_backends.TestFakeBackends
1ucian0 Jul 18, 2024
419dfbe
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 19, 2024
03f8574
test.python.providers.test_fake_backends
1ucian0 Jul 19, 2024
deb7380
test.python.compiler.test_transpiler
1ucian0 Jul 21, 2024
0fe2e02
remove catch
1ucian0 Jul 21, 2024
d185d7e
Apply suggestions from code review
1ucian0 Jul 21, 2024
ac54cd8
remove catch
1ucian0 Jul 21, 2024
9cd165b
new deprecate warning message
1ucian0 Jul 21, 2024
01c6716
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 21, 2024
a45431a
lint qiskit/assembler/assemble_circuits.py
1ucian0 Jul 22, 2024
ba4ad6b
Merge branch 'main' of github.com:Qiskit/qiskit-terra into fake_provi…
1ucian0 Jul 22, 2024
4751fe1
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 22, 2024
93030c7
udpate from deprecate/qobj_assemble/1
1ucian0 Jul 22, 2024
fa7f32d
concurrency warnings
1ucian0 Jul 22, 2024
2a085b5
ignore aer warnings
1ucian0 Jul 22, 2024
5e63bef
Update test/python/providers/fake_provider/test_fake_backends.py
1ucian0 Jul 23, 2024
83332e5
Update test/python/circuit/test_parameters.py
1ucian0 Jul 23, 2024
60cc9c5
Update qiskit/providers/models/pulsedefaults.py
1ucian0 Jul 23, 2024
1362b1b
Update test/python/providers/fake_provider/test_fake_backends.py
1ucian0 Jul 23, 2024
787090f
Update test/python/providers/fake_provider/test_generic_backend_v2.py
1ucian0 Jul 23, 2024
20a0c5c
lint
1ucian0 Jul 23, 2024
bd216a1
https://github.com/Qiskit/qiskit/pull/12649#discussion_r1686717954
1ucian0 Jul 23, 2024
c1c3b32
https://github.com/Qiskit/qiskit/pull/12649#discussion_r1686717732
1ucian0 Jul 23, 2024
7a2b3f7
Update test/python/transpiler/test_sabre_swap.py
1ucian0 Jul 23, 2024
5f19ae9
Update qiskit/providers/models/pulsedefaults.py
1ucian0 Jul 23, 2024
449c594
conflicts from deprecate/qobj_assemble/1
1ucian0 Jul 23, 2024
f8760ee
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 23, 2024
a761b2d
ignore Treating CircuitInstruction...
1ucian0 Jul 23, 2024
264f2af
another unnecessary catch from aer
1ucian0 Jul 24, 2024
4c76ad0
another unnecessary catch from aer, again
1ucian0 Jul 24, 2024
9741934
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 24, 2024
4e83c99
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 25, 2024
b69bdf9
removing more unnecesary catches
1ucian0 Jul 25, 2024
db985db
conflicts
1ucian0 Jul 25, 2024
8c7f685
less lines
1ucian0 Jul 25, 2024
a9802da
conflicts
1ucian0 Jul 25, 2024
cd21d30
seeding
1ucian0 Jul 25, 2024
f34620c
remove those comments
1ucian0 Jul 25, 2024
6013044
test.python.compiler.test_transpiler.TestTranspile.test_scheduling_ti…
1ucian0 Jul 25, 2024
ff36f48
tokyo cmap
1ucian0 Jul 25, 2024
5eb561e
test.python.circuit.test_scheduled_circuit.TestScheduledCircuit.test_…
1ucian0 Jul 25, 2024
4053ad4
conflict
1ucian0 Jul 25, 2024
469189c
comment in test_sequencer.py
1ucian0 Jul 25, 2024
11a82d4
test.python.compiler.test_transpiler.TestPostTranspileIntegration.tes…
1ucian0 Jul 25, 2024
3535925
Update test/python/primitives/test_primitive.py
1ucian0 Jul 25, 2024
e005b48
test/python/providers/test_backendconfiguration.py:30
1ucian0 Jul 25, 2024
adca82c
Merge branch 'fake_provider/backendV2/1' of github.com:1ucian0/qiskit…
1ucian0 Jul 25, 2024
10b0de4
test.python.primitives.test_backend_sampler
1ucian0 Jul 25, 2024
87aae01
Merge branch 'main' of github.com:Qiskit/qiskit-terra into fake_provi…
1ucian0 Jul 25, 2024
589e6f2
restore the assertWarns, waiting for #12818
1ucian0 Jul 26, 2024
fc9e4e1
conflicts
1ucian0 Jul 26, 2024
bd2e363
use legacy_cmaps instead of explict coupling maps
1ucian0 Jul 26, 2024
982e274
use more legacy_map
1ucian0 Jul 26, 2024
36633d1
KYOTO_CMAP
1ucian0 Jul 26, 2024
6b521db
more legacy_cmap
1ucian0 Jul 27, 2024
889173b
https://github.com/Qiskit/qiskit/issues/12832
1ucian0 Jul 27, 2024
772eb54
conflicts
1ucian0 Jul 27, 2024
2104e7d
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 28, 2024
6e8b1b2
Merge branch 'main' of github.com:Qiskit/qiskit-terra into fake_provi…
1ucian0 Jul 28, 2024
647d86c
Merge branch 'fake_provider/backendV2/1' into deprecate/providers/mod…
1ucian0 Jul 28, 2024
6febe72
test.python.transpiler.test_vf2_post_layout
1ucian0 Jul 28, 2024
52e9960
comma
1ucian0 Jul 29, 2024
c9b0680
Merge branch 'fake_provider/backendV2/1' into deprecate/backendv1
1ucian0 Jul 29, 2024
0c2b648
https://github.com/Qiskit/qiskit/pull/12660#discussion_r1694781920
1ucian0 Jul 29, 2024
74e9e70
Merge branch 'deprecate/backendv1' into deprecate/providers/models/1
1ucian0 Jul 29, 2024
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 qiskit/circuit/add_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def control(
) -> ControlledGate:
"""Return controlled version of gate using controlled rotations. This function
first checks the name of the operation to see if it knows of a method from which
to generate a controlled version. Currently these are `x`, `rx`, `ry`, and `rz`.
to generate a controlled version. Currently, these are `x`, `rx`, `ry`, and `rz`.
If a method is not directly known, it calls the unroller to convert to `u1`, `u3`,
and `cx` gates.

Expand Down
16 changes: 12 additions & 4 deletions qiskit/compiler/transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,18 @@ def callback_func(**kwargs):
optimization_level = config.get("transpile_optimization_level", 2)

if backend is not None and getattr(backend, "version", 0) <= 1:
# This is a temporary conversion step to allow for a smoother transition
# to a fully target-based transpiler pipeline while maintaining the behavior
# of `transpile` with BackendV1 inputs.
backend = BackendV2Converter(backend)
with warnings.catch_warnings():
# This is a temporary conversion step to allow for a smoother transition
# to a fully target-based transpiler pipeline while maintaining the behavior
# of `transpile` with BackendV1 inputs.
# TODO BackendV1 is deprecated and this path can be removed once it gets removed.
warnings.filterwarnings(
"ignore",
category=DeprecationWarning,
message=r".+qiskit\.providers\.backend_compat\.BackendV2Converter.+",
module="qiskit",
)
backend = BackendV2Converter(backend)

if (
scheduling_method is not None
Expand Down
11 changes: 10 additions & 1 deletion qiskit/providers/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from qiskit.providers.provider import Provider
from qiskit.providers.models.backendstatus import BackendStatus
from qiskit.circuit.gate import Instruction
from qiskit.utils import deprecate_func


class Backend:
Expand All @@ -43,7 +44,7 @@ class BackendV1(Backend, ABC):
This abstract class is to be used for Backend objects.
There are several classes of information contained in a Backend.
The first are the attributes of the class itself. These should be used to
defined the immutable characteristics of the backend. The ``options``
define the immutable characteristics of the backend. The ``options``
attribute of the backend is used to contain the dynamic user configurable
options of the backend. It should be used more for runtime options
that configure how the backend is used. For example, something like a
Expand Down Expand Up @@ -71,6 +72,14 @@ class BackendV1(Backend, ABC):

version = 1

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="If this backend is only a hardware description, consider constructing a "
"Target. If the provider also provides access for execution, it can construct "
"Primitives. Alternatebly, consider moving to BackendV2 "
"(see https://qisk.it/backendV1-to-V2).",
)
def __init__(self, configuration, provider=None, **fields):
"""Initialize a backend class

Expand Down
18 changes: 14 additions & 4 deletions qiskit/providers/backend_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from qiskit.providers.models.pulsedefaults import PulseDefaults
from qiskit.providers.options import Options
from qiskit.providers.exceptions import BackendPropertyError
from qiskit.utils import deprecate_func

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -352,6 +353,12 @@ class should only be used if you need a :class:`~.BackendV2` and still need
)
"""

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="Since ``BackendV1`` is deprecated, this conversion tool from BackendV1 to "
"BackendV2 is going to be removed with BackendV1.",
)
def __init__(
self,
backend: BackendV1,
Expand Down Expand Up @@ -390,10 +397,13 @@ def __init__(
self._properties = None
self._defaults = None

if hasattr(self._backend, "properties"):
self._properties = self._backend.properties()
if hasattr(self._backend, "defaults"):
self._defaults = self._backend.defaults()
with warnings.catch_warnings():
# The class QobjExperimentHeader is deprecated
warnings.filterwarnings("ignore", category=DeprecationWarning, module="qiskit")
if hasattr(self._backend, "properties"):
self._properties = self._backend.properties()
if hasattr(self._backend, "defaults"):
self._defaults = self._backend.defaults()

self._target = None
self._name_mapping = name_mapping
Expand Down
9 changes: 8 additions & 1 deletion qiskit/providers/fake_provider/fake_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from qiskit.providers import BackendV1
from qiskit import pulse
from qiskit.exceptions import QiskitError
from qiskit.utils import optionals as _optionals
from qiskit.utils import optionals as _optionals, deprecate_func
from qiskit.providers import basic_provider


Expand All @@ -39,6 +39,13 @@ def __init__(self, token="123456", url="https://"):
class FakeBackend(BackendV1):
"""This is a dummy backend just for testing purposes."""

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="Fake backends using BackendV1 are deprecated in favor of "
":class:`.GenericBackendV2`. You can convert BackendV1 to "
":class:`.BackendV2` with :class:`.BackendV2Converter`.",
)
def __init__(self, configuration, time_alive=10):
"""FakeBackend initializer.

Expand Down
6 changes: 5 additions & 1 deletion qiskit/providers/fake_provider/fake_qasm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import json
import os
import warnings

from qiskit.exceptions import QiskitError
from qiskit.providers.models import BackendProperties, QasmBackendConfiguration
Expand Down Expand Up @@ -61,7 +62,10 @@ def _set_props_from_json(self):
raise QiskitError("No properties file has been defined")
props = self._load_json(self.props_filename)
decode_backend_properties(props)
self._properties = BackendProperties.from_dict(props)
with warnings.catch_warnings():
# This raises BackendProperties internally
warnings.filterwarnings("ignore", category=DeprecationWarning, module="qiskit")
self._properties = BackendProperties.from_dict(props)

def _load_json(self, filename):
with open(os.path.join(self.dirname, filename)) as f_json:
Expand Down
16 changes: 5 additions & 11 deletions qiskit/providers/fake_provider/generic_backend_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,18 +567,12 @@ def _setup_sim(self) -> None:

@classmethod
def _default_options(cls) -> Options:
with warnings.catch_warnings(): # TODO remove catch once aer release without Provider ABC
warnings.filterwarnings(
"ignore",
category=DeprecationWarning,
message=".+abstract Provider and ProviderV1.+",
)
if _optionals.HAS_AER:
from qiskit_aer import AerSimulator
if _optionals.HAS_AER:
from qiskit_aer import AerSimulator

return AerSimulator._default_options()
else:
return BasicSimulator._default_options()
return AerSimulator._default_options()
else:
return BasicSimulator._default_options()

def drive_channel(self, qubit: int):
drive_channels_map = getattr(self, "channels_map", {}).get("drive", {})
Expand Down
11 changes: 11 additions & 0 deletions qiskit/providers/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
GateProperties
Nduv
"""
import warnings

from .backendconfiguration import (
BackendConfiguration,
Expand All @@ -50,3 +51,13 @@
from .backendstatus import BackendStatus
from .jobstatus import JobStatus
from .pulsedefaults import PulseDefaults, Command


warnings.warn(
"qiskit.providers.models is deprecated since Qiskit 1.2 and will be removed in Qiskit 2.0."
"With the removal of Qobj, there is no need for these schema-conformant objects. If you still need"
"to use them, it could be because you are using a BackendV1, which it is also deprecated in favor"
"of BackendV2",
DeprecationWarning,
2,
)
42 changes: 41 additions & 1 deletion qiskit/providers/models/backendconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
DriveChannel,
MeasureChannel,
)
from qiskit.utils import deprecate_func


class GateConfig:
Expand All @@ -38,6 +39,14 @@ class GateConfig:
and CX.
"""

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="This class is not necessary for BackendV2. If user still need Qobj, "
"that probably means that they are using a backend based on the "
"deprecated BackendV1 class.",
stacklevel=3,
)
def __init__(
self,
name,
Expand Down Expand Up @@ -141,6 +150,13 @@ class UchannelLO:
scale: Scale factor for qubit frequency.
"""

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="This class is not necessary for BackendV2. If user still need Qobj, "
"that probably means that they are using a backend based on the "
"deprecated BackendV1 class.",
)
def __init__(self, q, scale):
"""Initialize a UchannelLOSchema object

Expand Down Expand Up @@ -211,6 +227,14 @@ class QasmBackendConfiguration:

_data = {}

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="This class is not necessary for BackendV2. If user still need Qobj, "
"that probably means that they are using a backend based on the "
"deprecated BackendV1 class.",
stacklevel=3,
)
def __init__(
self,
backend_name,
Expand Down Expand Up @@ -493,14 +517,30 @@ def __contains__(self, item):
class BackendConfiguration(QasmBackendConfiguration):
"""Backwards compat shim representing an abstract backend configuration."""

pass
@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="The class `BackendConfiguration` is being deprecated "
"as they are not necessary for BackendV2. If user still need Qobj, that probably "
"means that they are using a backend based on the deprecated BackendV1 class.",
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


class PulseBackendConfiguration(QasmBackendConfiguration):
"""Static configuration state for an OpenPulse enabled backend. This contains information
about the set up of the device which can be useful for building Pulse programs.
"""

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="The class `PulseBackendConfiguration` is being deprecated "
"as they are not necessary for BackendV2. If user still need Qobj, "
"that probably means that they are using a backend based on the "
"deprecated BackendV1 class.",
)
def __init__(
self,
backend_name: str,
Expand Down
10 changes: 10 additions & 0 deletions qiskit/providers/models/backendproperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import dateutil.parser

from qiskit.providers.exceptions import BackendPropertyError
from qiskit.utils import deprecate_func
from qiskit.utils.units import apply_prefix

PropertyT = Tuple[Any, datetime.datetime]
Expand Down Expand Up @@ -172,6 +173,14 @@ class BackendProperties:

_data = {}

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="This class is not necessary for BackendV2. If user still need Qobj, "
"that probably means that they are using a backend based on the "
"deprecated BackendV1 class.",
stacklevel=3,
)
def __init__(
self, backend_name, backend_version, last_update_date, qubits, gates, general, **kwargs
):
Expand Down Expand Up @@ -248,6 +257,7 @@ def from_dict(cls, data):
qubits.append(nduvs)
gates = [GateProperties.from_dict(x) for x in in_data.pop("gates")]
general = [Nduv.from_dict(x) for x in in_data.pop("general")]

return cls(
backend_name, backend_version, last_update_date, qubits, gates, general, **in_data
)
Expand Down
18 changes: 17 additions & 1 deletion qiskit/transpiler/preset_passmanagers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,28 @@
.. autofunction:: generate_scheduling
.. currentmodule:: qiskit.transpiler.preset_passmanagers
"""
import copy
import warnings

from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES
from qiskit.circuit.library.standard_gates import get_standard_gate_name_mapping
from qiskit.providers.backend_compat import BackendV2Converter

from qiskit.transpiler.instruction_durations import InstructionDurations
from qiskit.transpiler.timing_constraints import TimingConstraints

from qiskit.transpiler.passmanager_config import PassManagerConfig
from qiskit.transpiler.target import Target, target_to_backend_properties
from qiskit.transpiler import CouplingMap

from qiskit.transpiler.exceptions import TranspilerError

from .generate_preset_pass_manager import generate_preset_pass_manager
from .level0 import level_0_pass_manager
from .level1 import level_1_pass_manager
from .level2 import level_2_pass_manager
from .level3 import level_3_pass_manager
from .generate_preset_pass_manager import generate_preset_pass_manager


__all__ = [
"level_0_pass_manager",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""

import copy
import warnings

from qiskit.circuit.controlflow import CONTROL_FLOW_OP_NAMES
from qiskit.circuit.library.standard_gates import get_standard_gate_name_mapping
Expand Down Expand Up @@ -331,7 +332,16 @@ def generate_preset_pass_manager(
if timing_constraints is None:
timing_constraints = target.timing_constraints()
if backend_properties is None:
backend_properties = target_to_backend_properties(target)
with warnings.catch_warnings():
# TODO this branch (targe-to-properties) is going to be removed soon (1.3) in favor
# of backend-to-target approach
warnings.filterwarnings(
"ignore",
category=DeprecationWarning,
message=r".+qiskit\.transpiler\.target\.target_to_backend_properties.+",
module="qiskit",
)
backend_properties = target_to_backend_properties(target)

# Parse non-target dependent pm options
initial_layout = _parse_initial_layout(initial_layout)
Expand Down
Loading
Loading