From 07fd2bdcf10950f946787470521b04c478602a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 16 Feb 2024 13:57:54 +0100 Subject: [PATCH] chore(lib): warn about non-preferred-qt-version (#373) Closes #371 --- manim_slides/present/__init__.py | 19 +++++++++++++++++++ pyproject.toml | 8 +++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/manim_slides/present/__init__.py b/manim_slides/present/__init__.py index 49f2aa43..ebf9ac92 100644 --- a/manim_slides/present/__init__.py +++ b/manim_slides/present/__init__.py @@ -11,6 +11,23 @@ from ..config import Config, PresentationConfig from ..logger import logger +PREFERRED_QT_VERSIONS = ("6.5.1", "6.5.2") + + +def warn_if_non_desirable_pyside6_version() -> None: + from qtpy import API, QT_VERSION + + if sys.version_info < (3, 12) and ( + API != "pyside6" or QT_VERSION not in PREFERRED_QT_VERSIONS + ): + logger.warn( + f"You are using {API = }, {QT_VERSION = }, " + "but we recommend installing 'PySide6==6.5.2', mainly to avoid " + "flashing screens between slides, " + "see issue https://github.com/jeertmans/manim-slides/issues/293. " + "You can do so with `pip install 'manim-slides[pyside6]'`." + ) + @click.command() @folder_path_option @@ -276,6 +293,8 @@ def present( if start_at[1]: start_at_slide_number = start_at[1] + warn_if_non_desirable_pyside6_version() + from ..qt_utils import qapp app = qapp() diff --git a/pyproject.toml b/pyproject.toml index 4e7dd5fb..c69ce982 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -126,6 +126,11 @@ filterwarnings = [ [tool.ruff] extend-exclude = ["manim_slides/resources.py"] +extend-include = ["*.ipynb"] +line-length = 88 +target-version = "py38" + +[tool.ruff.lint] extend-ignore = [ "D100", "D101", @@ -140,8 +145,5 @@ extend-ignore = [ "D212", "E501", ] -extend-include = ["*.ipynb"] extend-select = ["B", "C90", "D", "I", "N", "RUF", "UP", "T"] isort = {known-first-party = ["manim_slides", "tests"]} -line-length = 88 -target-version = "py38"