Skip to content

Commit

Permalink
PyQt6 -> PySide6
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Peter Krone committed Dec 19, 2024
1 parent b2f370b commit a817bc9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test = [
"ipywidgets",
# needed by ipywidgets >= 8.0.6
"ipykernel",
"PyQt6",
"PySide6",
"joblib",
"jacobi",
"matplotlib",
Expand Down
2 changes: 1 addition & 1 deletion src/iminuit/minuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2343,7 +2343,7 @@ def interactive(
"""
Interactive GUI for fitting.
Starts a fitting application (requires PyQt6, matplotlib) in which the
Starts a fitting application (requires PySide6, matplotlib) in which the
fit is visualized and the parameters can be manipulated to find good
starting parameters and to debug the fit.
Expand Down
6 changes: 3 additions & 3 deletions src/iminuit/qtwidget.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Interactive fitting widget using PyQt6."""
"""Interactive fitting widget using PySide6."""

from .util import _widget_guess_initial_step, _make_finite
import warnings
Expand All @@ -7,12 +7,12 @@
from contextlib import contextmanager

try:
from PyQt6 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from matplotlib import pyplot as plt
except ModuleNotFoundError as e:
e.msg += (
"\n\nPlease install PyQt6, and matplotlib to enable interactive "
"\n\nPlease install PySide6, and matplotlib to enable interactive "
"outside of Jupyter notebooks."
)
raise
Expand Down
10 changes: 5 additions & 5 deletions tests/test_qtwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

mpl = pytest.importorskip("matplotlib")
plt = pytest.importorskip("matplotlib.pyplot")
PyQt6 = pytest.importorskip("PyQt6")
PySide6 = pytest.importorskip("PySide6")

mpl.use("Agg")

Expand All @@ -17,7 +17,7 @@ def qtinteractive(m, plot=None, raise_on_exception=False, **kwargs):


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_interactive_pyqt6(qtbot):
def test_interactive_pyside6(qtbot):
def cost(a, b):
return a**2 + b**2

Expand All @@ -44,7 +44,7 @@ def assert_call(self):
with plot.assert_call():
mw1 = qtinteractive(m, plot)
qtbot.addWidget(mw1)
assert isinstance(mw1, PyQt6.QtWidgets.QWidget)
assert isinstance(mw1, PySide6.QtWidgets.QWidget)

# manipulate state to also check this code
with plot.assert_call():
Expand Down Expand Up @@ -119,7 +119,7 @@ def __call__(self, a, b):


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_interactive_pyqt6_raises(qtbot):
def test_interactive_pyside6_raises(qtbot):
def raiser(args):
raise ValueError

Expand All @@ -133,7 +133,7 @@ def raiser(args):


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_interactive_pyqt6_with_array_func(qtbot):
def test_interactive_pyside6_with_array_func(qtbot):
def cost(par):
return par[0] ** 2 + (par[1] / 2) ** 2

Expand Down
12 changes: 6 additions & 6 deletions tests/test_without_pyqt6.py → tests/test_without_pyside6.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
pytest.importorskip("matplotlib")


def test_pyqt6_interactive_with_ipython():
def test_pyside6_interactive_with_ipython():
pytest.importorskip("IPython")
import iminuit

cost = LeastSquares([1.1, 2.2], [3.3, 4.4], 1, lambda x, a: a * x)

with hide_modules("PyQt6", reload="iminuit.qtwidget"):
with pytest.raises(ModuleNotFoundError, match="Please install PyQt6"):
with hide_modules("PySide6", reload="iminuit.qtwidget"):
with pytest.raises(ModuleNotFoundError, match="Please install PySide6"):
iminuit.Minuit(cost, 1).interactive()


def test_pyqt6_interactive_without_ipython():
def test_pyside6_interactive_without_ipython():
import iminuit

cost = LeastSquares([1.1, 2.2], [3.3, 4.4], 1, lambda x, a: a * x)

with hide_modules("PyQt6", "IPython", reload="iminuit.qtwidget"):
with pytest.raises(ModuleNotFoundError, match="Please install PyQt6"):
with hide_modules("PySide6", "IPython", reload="iminuit.qtwidget"):
with pytest.raises(ModuleNotFoundError, match="Please install PySide6"):
iminuit.Minuit(cost, 1).interactive()

0 comments on commit a817bc9

Please sign in to comment.