mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-21 20:46:01 +08:00
feat(cli): check for newer Manim Slides version (#85)
* chore(deps): drop support for Python 3.7 In link with the recent release of [Manim v0.17.0](https://github.com/ManimCommunity/manim/releases/tag/v0.17.0), Manim Slides drops support for Python 3.7. * feat(cli): check for newer Manim Slides version Uses same logic as manim to check for a new version * fix(lib): reset correct version * fix(ci): add type stubs for requests
This commit is contained in:
10
.github/workflows/test_examples.yml
vendored
10
.github/workflows/test_examples.yml
vendored
@ -17,23 +17,17 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
manim: [manim, manimgl]
|
manim: [manim, manimgl]
|
||||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
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:
|
exclude:
|
||||||
# excludes manimgl on Windows because if throws errors
|
# excludes manimgl on Windows because if throws errors
|
||||||
# related to OpenGL, which seems hard to fix:
|
# related to OpenGL, which seems hard to fix:
|
||||||
# Your graphics drivers do not support OpenGL 2.0.
|
# Your graphics drivers do not support OpenGL 2.0.
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
manim: manimgl
|
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
|
# manimgl seems to have problems with Python 3.11
|
||||||
- manim: manimgl
|
- manim: manimgl
|
||||||
pyversion: '3.11'
|
pyversion: '3.11'
|
||||||
# We only test Python 3.11 on Windows and MacOS
|
# We only test Python 3.11 on Windows and MacOS
|
||||||
- os: windows-latest
|
|
||||||
pyversion: '3.7'
|
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
pyversion: '3.8'
|
pyversion: '3.8'
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
@ -41,8 +35,6 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
pyversion: '3.10'
|
pyversion: '3.10'
|
||||||
manim: manim
|
manim: manim
|
||||||
- os: macos-latest
|
|
||||||
pyversion: '3.7'
|
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
pyversion: '3.8'
|
pyversion: '3.8'
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
|
@ -29,7 +29,7 @@ repos:
|
|||||||
rev: 'v0.991'
|
rev: 'v0.991'
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
additional_dependencies: [types-setuptools]
|
additional_dependencies: [types-requests, types-setuptools]
|
||||||
args:
|
args:
|
||||||
- --install-types
|
- --install-types
|
||||||
- --non-interactive
|
- --non-interactive
|
||||||
|
@ -1,22 +1,66 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
import requests
|
||||||
from click_default_group import DefaultGroup
|
from click_default_group import DefaultGroup
|
||||||
|
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from .convert import convert
|
from .convert import convert
|
||||||
|
from .manim import logger
|
||||||
from .present import list_scenes, present
|
from .present import list_scenes, present
|
||||||
from .wizard import init, wizard
|
from .wizard import init, wizard
|
||||||
|
|
||||||
|
|
||||||
@click.group(cls=DefaultGroup, default="present", default_if_no_args=True)
|
@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.version_option(__version__, "-v", "--version")
|
||||||
@click.help_option("-h", "--help")
|
@click.help_option("-h", "--help")
|
||||||
def cli() -> None:
|
def cli(notify_outdated_version: bool) -> None:
|
||||||
"""
|
"""
|
||||||
Manim Slides command-line utilities.
|
Manim Slides command-line utilities.
|
||||||
|
|
||||||
If no command is specified, defaults to `present`.
|
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)
|
cli.add_command(convert)
|
||||||
|
@ -9,7 +9,6 @@ import click
|
|||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
from PySide6 import QtGui
|
|
||||||
from PySide6.QtCore import Qt, QThread, Signal, Slot
|
from PySide6.QtCore import Qt, QThread, Signal, Slot
|
||||||
from PySide6.QtGui import QCloseEvent, QIcon, QImage, QKeyEvent, QPixmap, QResizeEvent
|
from PySide6.QtGui import QCloseEvent, QIcon, QImage, QKeyEvent, QPixmap, QResizeEvent
|
||||||
from PySide6.QtWidgets import QApplication, QGridLayout, QLabel, QWidget
|
from PySide6.QtWidgets import QApplication, QGridLayout, QLabel, QWidget
|
||||||
|
@ -8,9 +8,10 @@ description = "Tool for live presentations using manim"
|
|||||||
authors = [
|
authors = [
|
||||||
{ name = "Jérome Eertmans", email = "jeertmans@icloud.com" }
|
{ name = "Jérome Eertmans", email = "jeertmans@icloud.com" }
|
||||||
]
|
]
|
||||||
|
version = "4.6.0"
|
||||||
license = {file = "LICENSE.md"}
|
license = {file = "LICENSE.md"}
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.7"
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
keywords = ["manim", "slides", "plugin", "manimgl"]
|
keywords = ["manim", "slides", "plugin", "manimgl"]
|
||||||
|
|
||||||
@ -32,14 +33,13 @@ dependencies = [
|
|||||||
"click>=8.0",
|
"click>=8.0",
|
||||||
"click-default-group>=1.2",
|
"click-default-group>=1.2",
|
||||||
"numpy>=1.19.3",
|
"numpy>=1.19.3",
|
||||||
|
"opencv-python>=4.6",
|
||||||
"pydantic>=1.9.1",
|
"pydantic>=1.9.1",
|
||||||
"pyside6>=6",
|
"pyside6>=6",
|
||||||
"opencv-python>=4.6",
|
"requests>=2.26.0",
|
||||||
"tqdm>=4.62.3",
|
"tqdm>=4.62.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
dynamic = ["version"]
|
|
||||||
|
|
||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
packages = ["manim_slides"]
|
packages = ["manim_slides"]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user