diff --git a/.github/workflows/test_examples.yml b/.github/workflows/test_examples.yml index ec045fb..1f4e88d 100644 --- a/.github/workflows/test_examples.yml +++ b/.github/workflows/test_examples.yml @@ -17,23 +17,17 @@ jobs: matrix: manim: [manim, manimgl] os: [macos-latest, ubuntu-latest, windows-latest] - pyversion: ['3.7', '3.8', '3.9', '3.10', '3.11'] + pyversion: ['3.8', '3.9', '3.10', '3.11'] exclude: # excludes manimgl on Windows because if throws errors # related to OpenGL, which seems hard to fix: # Your graphics drivers do not support OpenGL 2.0. - os: windows-latest manim: manimgl - # manimgl actually requires Python >= 3.8, see: - # https://github.com/3b1b/manim/issues/1808 - - manim: manimgl - pyversion: '3.7' # manimgl seems to have problems with Python 3.11 - manim: manimgl pyversion: '3.11' # We only test Python 3.11 on Windows and MacOS - - os: windows-latest - pyversion: '3.7' - os: windows-latest pyversion: '3.8' - os: windows-latest @@ -41,8 +35,6 @@ jobs: - os: windows-latest pyversion: '3.10' manim: manim - - os: macos-latest - pyversion: '3.7' - os: macos-latest pyversion: '3.8' - os: macos-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2679b14..1fdee5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: rev: 'v0.991' hooks: - id: mypy - additional_dependencies: [types-setuptools] + additional_dependencies: [types-requests, types-setuptools] args: - --install-types - --non-interactive diff --git a/manim_slides/__main__.py b/manim_slides/__main__.py index ba10445..685fd12 100644 --- a/manim_slides/__main__.py +++ b/manim_slides/__main__.py @@ -1,22 +1,66 @@ +import json + import click +import requests from click_default_group import DefaultGroup from . import __version__ from .convert import convert +from .manim import logger from .present import list_scenes, present from .wizard import init, wizard @click.group(cls=DefaultGroup, default="present", default_if_no_args=True) +@click.option( + "--notify-outdated-version/--silent", + " /-S", + is_flag=True, + default=True, + help="Check if a new version of Manim Slides is available.", +) @click.version_option(__version__, "-v", "--version") @click.help_option("-h", "--help") -def cli() -> None: +def cli(notify_outdated_version: bool) -> None: """ Manim Slides command-line utilities. If no command is specified, defaults to `present`. """ - pass + # Code below is mostly a copy from: + # https://github.com/ManimCommunity/manim/blob/main/manim/cli/render/commands.py + if notify_outdated_version: + manim_info_url = "https://pypi.org/pypi/manim-slides/json" + warn_prompt = "Cannot check if latest release of Manim Slides is installed" + try: + req_info: requests.models.Response = requests.get( + manim_info_url, timeout=10 + ) + req_info.raise_for_status() + stable = req_info.json()["info"]["version"] + if stable != __version__: + click.echo( + "You are using Manim Slides version " + + click.style(f"v{__version__}", fg="red") + + ", but version " + + click.style(f"v{stable}", fg="green") + + " is available." + ) + click.echo( + "You should consider upgrading via " + + click.style("pip install -U manim-slides", fg="yellow") + ) + except requests.exceptions.HTTPError: + logger.debug(f"HTTP Error: {warn_prompt}") + except requests.exceptions.ConnectionError: + logger.debug(f"Connection Error: {warn_prompt}") + except requests.exceptions.Timeout: + logger.debug(f"Timed Out: {warn_prompt}") + except json.JSONDecodeError: + logger.debug(warn_prompt) + logger.debug(f"Error decoding JSON from {manim_info_url}") + except Exception: + logger.debug(f"Something went wrong: {warn_prompt}") cli.add_command(convert) diff --git a/manim_slides/present.py b/manim_slides/present.py index d6cf37c..d4bf93c 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -9,7 +9,6 @@ import click import cv2 import numpy as np from pydantic import ValidationError -from PySide6 import QtGui from PySide6.QtCore import Qt, QThread, Signal, Slot from PySide6.QtGui import QCloseEvent, QIcon, QImage, QKeyEvent, QPixmap, QResizeEvent from PySide6.QtWidgets import QApplication, QGridLayout, QLabel, QWidget diff --git a/pyproject.toml b/pyproject.toml index c205c76..629e430 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,9 +8,10 @@ description = "Tool for live presentations using manim" authors = [ { name = "Jérome Eertmans", email = "jeertmans@icloud.com" } ] +version = "4.6.0" license = {file = "LICENSE.md"} readme = "README.md" -requires-python = ">=3.7" +requires-python = ">=3.8" keywords = ["manim", "slides", "plugin", "manimgl"] @@ -32,14 +33,13 @@ dependencies = [ "click>=8.0", "click-default-group>=1.2", "numpy>=1.19.3", + "opencv-python>=4.6", "pydantic>=1.9.1", "pyside6>=6", - "opencv-python>=4.6", + "requests>=2.26.0", "tqdm>=4.62.3", ] -dynamic = ["version"] - [tool.setuptools] packages = ["manim_slides"]