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 legacy qcstyle module #11545

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ def draw(
The search path for style json files can be specified in the user
config, for example,
``circuit_mpl_style_path = /home/user/styles:/home/user``.
See: :class:`~qiskit.visualization.qcstyle.DefaultStyle` for more
See: :class:`~qiskit.visualization.circuit.qcstyle.DefaultStyle` for more
information on the contents.
interactive (bool): when set to true, show the circuit in a new window
(for `mpl` this depends on the matplotlib backend being used
Expand Down
2 changes: 1 addition & 1 deletion qiskit/visualization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
:toctree: ../stubs/

circuit_drawer
~qiskit.visualization.qcstyle.DefaultStyle
~qiskit.visualization.circuit.qcstyle.DefaultStyle

DAG Visualizations
==================
Expand Down
2 changes: 1 addition & 1 deletion qiskit/visualization/circuit/circuit_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def circuit_drawer(
The search path for style json files can be specified in the user
config, for example,
``circuit_mpl_style_path = /home/user/styles:/home/user``.
See: :class:`~qiskit.visualization.qcstyle.DefaultStyle` for more
See: :class:`~qiskit.visualization.circuit.qcstyle.DefaultStyle` for more
information on the contents.
output (str): select the output method to use for drawing the circuit.
Valid choices are ``text``, ``mpl``, ``latex``, ``latex_source``.
Expand Down
8 changes: 8 additions & 0 deletions qiskit/visualization/qcstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@

# Temporary import from 0.22.0 to be deprecated in future
# pylint: disable=unused-wildcard-import,wildcard-import
import warnings
from .circuit.qcstyle import *

warnings.warn(
"The qiskit.visualization.qcstyle module is deprecated as of Qiskit 0.46.0 and will be removed "
"for Qiskit 1.0. Use the qiskit.visualization.circuit.qcstyle as direct replacement.",
stacklevel=2,
category=DeprecationWarning,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
deprecations:
- |
Deprecate the :mod:`qiskit.visualization.qcstyle` module. Use
:mod:`qiskit.visualization.circuit.qcstyle` as direct replacement.
6 changes: 6 additions & 0 deletions test/visual/mpl/circuit/test_circuit_matplotlib_drawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,12 @@ def test_no_qreg_names_after_layout(self):
)
self.assertGreaterEqual(ratio, 0.9999)

def test_qcstyle_legacy_import(self):
"""Test importing from the legacy import location raises a deprecation warning."""
with self.assertRaises(DeprecationWarning):
# pylint: disable=unused-import
from qiskit.visualization.qcstyle import DefaultStyle


if __name__ == "__main__":
unittest.main(verbosity=1)