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 BackendV1 and qiskit.providers.models #12629

Merged
merged 202 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 195 commits
Commits
Show all changes
202 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
ea1de69
Merge branch 'main' into deprecate/backendv1
1ucian0 Jul 29, 2024
fa3f6fc
Merge branch 'deprecate/providers/models/1' into deprecate/backendv1
1ucian0 Jul 29, 2024
f80ce38
do not deprecate BackendV2Converter yet
1ucian0 Jul 29, 2024
b28394b
test.python.providers.test_faulty_backend
1ucian0 Jul 29, 2024
f16ad3a
test.python.compiler.test_transpiler.TestTranspile
1ucian0 Jul 29, 2024
47211b1
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 29, 2024
6bfcbbf
cleaning up warnings
1ucian0 Jul 29, 2024
15961b8
Merge branch 'main' of github.com:Qiskit/qiskit-terra into deprecate/…
1ucian0 Jul 30, 2024
ce993d7
no deprecation in test/python/compiler/test_transpiler.py
1ucian0 Jul 30, 2024
5db7ec3
Apply suggestions from code review
1ucian0 Jul 30, 2024
d4f22cc
reno lint
1ucian0 Jul 30, 2024
baa16f1
adding models in reno
1ucian0 Jul 30, 2024
0910b6a
black
1ucian0 Jul 30, 2024
048fef5
test.python.transpiler.test_preset_passmanagers
1ucian0 Jul 30, 2024
4284501
seeding GenericBackendV2
1ucian0 Jul 30, 2024
11c1e18
less Fake5QV1
1ucian0 Jul 30, 2024
b0c16ee
test.python.transpiler.test_sabre_layout
1ucian0 Jul 30, 2024
8681761
test.python.transpiler.test_pulse_gate_pass
1ucian0 Jul 30, 2024
1086706
test.python.pulse.test_builder
1ucian0 Jul 30, 2024
241f2dd
test.python.primitives.test_backend_sampler_v2
1ucian0 Jul 30, 2024
2991bc8
test.python.primitives.test_backend_sampler_v2
1ucian0 Jul 30, 2024
dc210de
test.python.primitives.test_backend_estimator_v2
1ucian0 Jul 30, 2024
ac542e5
test.python.compiler.test_transpiler
1ucian0 Jul 30, 2024
ae46bcc
Apply suggestions from code review
1ucian0 Jul 30, 2024
b672edd
Apply suggestions from code review
1ucian0 Jul 30, 2024
433768f
test.python.primitives.test_backend_estimator_v2.TestBackendEstimatorV2
1ucian0 Jul 30, 2024
8ba5437
test.python.primitives.test_backend_estimator_v2
1ucian0 Jul 30, 2024
cd5d8ef
Fix expected_regex in transpile tests
ElePT Jul 31, 2024
2d57de8
Fix missing assertions in:
ElePT Jul 31, 2024
cf3c12d
Fix line-too-long lint complaints
ElePT Jul 31, 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
25 changes: 21 additions & 4 deletions qiskit/compiler/transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,27 @@ 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)
warnings.warn(
f"The function transpile will stop supporting BackendV1 {backend} "
"in the backend parameter not earlier than the release of 2.0. "
"BackendV1 is deprecated and and providers should move to BackendV2.",
1ucian0 marked this conversation as resolved.
Show resolved Hide resolved
category=DeprecationWarning,
stacklevel=2,
)
with warnings.catch_warnings():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For full transparency, should we raise a custom deprecation message to indicate that from 2.0 onwards transpile will not be accepting V1 backends as inputs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea... this found several unnecessary usages of BackendV1. It will take me some time to adapt them.

Copy link
Member Author

@1ucian0 1ucian0 Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding it in 048fef5

# 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:
# https://github.com/Qiskit/qiskit/pull/12850
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
10 changes: 9 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,13 @@ class BackendV1(Backend, ABC):

version = 1

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="If the backend only encapsulates a hardware description, consider constructing a "
"Target directly. If it is part of a provider that gives access to execution, consider using Primitives instead. "
"Alternatively, consider moving to BackendV2 (see https://qisk.it/backendV1-to-V2).",
)
def __init__(self, configuration, provider=None, **fields):
"""Initialize a backend class

Expand Down
11 changes: 7 additions & 4 deletions qiskit/providers/backend_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,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
44 changes: 26 additions & 18 deletions qiskit/providers/basic_provider/basic_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,32 @@ def configuration(self) -> BackendConfiguration:
for name in self.target.operation_names
]

self._configuration = BackendConfiguration(
backend_name=self.name,
backend_version=self.backend_version,
n_qubits=self.num_qubits,
basis_gates=self.target.operation_names,
gates=gates,
local=True,
simulator=True,
conditional=True,
open_pulse=False,
memory=True,
# This max_shots is used by the assembler, setting it to 0
# to maintain the behavior from the previous implementation.
# Not related to the actual shots set in the backend options
max_shots=0,
coupling_map=None,
description="A python simulator for quantum experiments",
)
with warnings.catch_warnings():
# TODO Provider models are deprecated
# https://github.com/Qiskit/qiskit/issues/12843
warnings.filterwarnings(
"ignore",
category=DeprecationWarning,
message=r".+qiskit\.providers\.models\.backendconfiguration\..+",
)
self._configuration = BackendConfiguration(
backend_name=self.name,
backend_version=self.backend_version,
n_qubits=self.num_qubits,
basis_gates=self.target.operation_names,
gates=gates,
local=True,
simulator=True,
conditional=True,
open_pulse=False,
memory=True,
# This max_shots is used by the assembler, setting it to 0
# to maintain the behavior from the previous implementation.
# Not related to the actual shots set in the backend options
max_shots=0,
coupling_map=None,
description="A python simulator for quantum experiments",
)
return self._configuration

@classmethod
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 the BackendProperties deprecation warning 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
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 is also deprecated in favor"
"of BackendV2",
DeprecationWarning,
2,
)
50 changes: 48 additions & 2 deletions 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,15 @@ class GateConfig:
and CX.
"""

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="The models in ``qiskit.providers.models`` are part "
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
"workflow requires these representations it likely relies on deprecated functionality and "
"should be updated to use `BackendV2`.",
stacklevel=3,
)
def __init__(
self,
name,
Expand Down Expand Up @@ -141,6 +151,14 @@ class UchannelLO:
scale: Scale factor for qubit frequency.
"""

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="The models in ``qiskit.providers.models`` are part "
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
"workflow requires these representations it likely relies on deprecated functionality and "
"should be updated to use `BackendV2`.",
)
def __init__(self, q, scale):
"""Initialize a UchannelLOSchema object

Expand Down Expand Up @@ -211,6 +229,15 @@ class QasmBackendConfiguration:

_data = {}

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="The models in ``qiskit.providers.models`` are part "
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
"workflow requires these representations it likely relies on deprecated functionality and "
"should be updated to use `BackendV2`.",
stacklevel=3,
)
def __init__(
self,
backend_name,
Expand Down Expand Up @@ -491,16 +518,35 @@ def __contains__(self, item):


class BackendConfiguration(QasmBackendConfiguration):
"""Backwards compat shim representing an abstract backend configuration."""
"""Backwards compatibility shim representing an abstract backend configuration."""

pass
@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="The models in ``qiskit.providers.models`` are part "
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
"workflow requires these representations it likely relies on deprecated functionality and "
"should be updated to use `BackendV2`.",
stacklevel=3,
)
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 models in ``qiskit.providers.models`` are part "
"of the deprecated `BackendV1` workflow and no longer necessary for `BackendV2`. If a user "
"workflow requires these representations it likely relies on deprecated functionality and "
"should be updated to use `BackendV2`.",
stacklevel=3,
)
def __init__(
self,
backend_name: str,
Expand Down
11 changes: 11 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,15 @@ class BackendProperties:

_data = {}

@deprecate_func(
since="1.2",
removal_timeline="in the 2.0 release",
additional_msg="The models in ``qiskit.providers.models`` and related objects are part "
"of the deprecated `BackendV1` workflow, and no longer necessary for `BackendV2`. If a user "
"workflow requires these representations it likely relies on deprecated functionality and "
"should be updated to use `BackendV2`.",
stacklevel=3,
)
def __init__(
self, backend_name, backend_version, last_update_date, qubits, gates, general, **kwargs
):
Expand Down Expand Up @@ -248,6 +258,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
4 changes: 2 additions & 2 deletions qiskit/transpiler/preset_passmanagers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
.. autofunction:: generate_scheduling
.. currentmodule:: qiskit.transpiler.preset_passmanagers
"""

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 @@ -254,6 +255,14 @@ def generate_preset_pass_manager(
# 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.
warnings.warn(
"The function generate_preset_pass_manager will stop supporting "
f"BackendV1 {backend} "
"in the backend parameter not earlier than the release of 2.0. "
"BackendV1 is deprecated and and providers should move to BackendV2.",
1ucian0 marked this conversation as resolved.
Show resolved Hide resolved
category=DeprecationWarning,
stacklevel=2,
)
backend = BackendV2Converter(backend)

# Check if a custom inst_map was specified before overwriting inst_map
Expand Down Expand Up @@ -331,7 +340,17 @@ def generate_preset_pass_manager(
if timing_constraints is None:
timing_constraints = target.timing_constraints()
if backend_properties is None:
1ucian0 marked this conversation as resolved.
Show resolved Hide resolved
backend_properties = target_to_backend_properties(target)
with warnings.catch_warnings():
# TODO this approach (target-to-properties) is going to be removed soon (1.3) in favor
# of backend-to-target approach
# https://github.com/Qiskit/qiskit/pull/12850
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