mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Update dependency constraints, fix deprecation warnings (#3376)
* WIP: Update metadata * Finish removing upper bounds Drop requests dependency, use urllib instead order depencencies * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix issues on 3.12 * Order dev dependencies * Update most dev deps, update lint config * Add missing import * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * trigger CI * More deprecation fixes * Missing argument * Deprecation fixes, again * Use older xdist to fix test flakyness --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
6949c66922
commit
61a2d05b69
20 changed files with 1151 additions and 2040 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
|
||||
- name: Install Poetry
|
||||
run: |
|
||||
pipx install "poetry==1.5.*"
|
||||
pipx install "poetry==1.7.*"
|
||||
poetry config virtualenvs.prefer-active-python true
|
||||
|
||||
- name: Setup Python ${{ matrix.python }}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pkg_resources
|
||||
from importlib.metadata import version
|
||||
|
||||
__version__: str = pkg_resources.get_distribution(__name__).version
|
||||
__version__ = version(__name__)
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
# isort: off
|
||||
|
||||
# Importing the config module should be the first thing we do, since other
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ from __future__ import annotations
|
|||
|
||||
import sys
|
||||
|
||||
import click
|
||||
import cloup
|
||||
|
||||
from . import __version__, cli_ctx_settings, console
|
||||
|
|
@ -35,7 +34,7 @@ console.print(f"Manim Community [green]v{__version__}[/green]\n")
|
|||
"is specified. Run 'manim render --help' if you would like to know what the "
|
||||
f"'-ql' or '-p' flags do, for example.\n\n{EPILOG}",
|
||||
)
|
||||
@click.option(
|
||||
@cloup.option(
|
||||
"--version",
|
||||
is_flag=True,
|
||||
help="Show version and exit.",
|
||||
|
|
@ -43,7 +42,7 @@ console.print(f"Manim Community [green]v{__version__}[/green]\n")
|
|||
is_eager=True,
|
||||
expose_value=False,
|
||||
)
|
||||
@click.pass_context
|
||||
@cloup.pass_context
|
||||
def main(ctx):
|
||||
"""The entry point for manim."""
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -973,8 +973,8 @@ class Camera:
|
|||
sub_image = Image.fromarray(image_mobject.get_pixel_array(), mode="RGBA")
|
||||
|
||||
# Reshape
|
||||
pixel_width = max(int(pdist([ul_coords, ur_coords])), 1)
|
||||
pixel_height = max(int(pdist([ul_coords, dl_coords])), 1)
|
||||
pixel_width = max(int(pdist([ul_coords, ur_coords]).item()), 1)
|
||||
pixel_height = max(int(pdist([ul_coords, dl_coords]).item()), 1)
|
||||
sub_image = sub_image.resize(
|
||||
(pixel_width, pixel_height),
|
||||
resample=image_mobject.resampling_algorithm,
|
||||
|
|
|
|||
|
|
@ -7,11 +7,9 @@ group.
|
|||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from ast import literal_eval
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
import cloup
|
||||
from rich.errors import StyleSyntaxError
|
||||
from rich.style import Style
|
||||
|
|
@ -123,21 +121,21 @@ def replace_keys(default: dict) -> dict:
|
|||
epilog=EPILOG,
|
||||
help="Manages Manim configuration files.",
|
||||
)
|
||||
@click.pass_context
|
||||
@cloup.pass_context
|
||||
def cfg(ctx):
|
||||
"""Responsible for the cfg subcommand."""
|
||||
pass
|
||||
|
||||
|
||||
@cfg.command(context_settings=cli_ctx_settings, no_args_is_help=True)
|
||||
@click.option(
|
||||
@cloup.option(
|
||||
"-l",
|
||||
"--level",
|
||||
type=click.Choice(["user", "cwd"], case_sensitive=False),
|
||||
type=cloup.Choice(["user", "cwd"], case_sensitive=False),
|
||||
default="cwd",
|
||||
help="Specify if this config is for user or the working directory.",
|
||||
)
|
||||
@click.option("-o", "--open", "openfile", is_flag=True)
|
||||
@cloup.option("-o", "--open", "openfile", is_flag=True)
|
||||
def write(level: str = None, openfile: bool = False) -> None:
|
||||
config_paths = config_file_paths()
|
||||
console.print(
|
||||
|
|
@ -258,8 +256,8 @@ def show():
|
|||
|
||||
|
||||
@cfg.command(context_settings=cli_ctx_settings)
|
||||
@click.option("-d", "--directory", default=Path.cwd())
|
||||
@click.pass_context
|
||||
@cloup.option("-d", "--directory", default=Path.cwd())
|
||||
@cloup.pass_context
|
||||
def export(ctx, directory):
|
||||
directory_path = Path(directory)
|
||||
if directory_path.absolute == Path.cwd().absolute:
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
"""DefaultGroup allows a subcommand to act as the main command
|
||||
"""``DefaultGroup`` allows a subcommand to act as the main command.
|
||||
|
||||
In particular, this class is what allows ``manim`` to act as ``manim render``.
|
||||
"""
|
||||
import cloup
|
||||
|
||||
from .. import logger
|
||||
.. note::
|
||||
This is a vendored version of https://github.com/click-contrib/click-default-group/
|
||||
under the BSD 3-Clause "New" or "Revised" License.
|
||||
|
||||
This library isn't used as a dependency as we need to inherit from ``cloup.Group`` instead
|
||||
of ``click.Group``.
|
||||
"""
|
||||
import warnings
|
||||
|
||||
import cloup
|
||||
|
||||
__all__ = ["DefaultGroup"]
|
||||
|
||||
|
|
@ -54,8 +61,8 @@ class DefaultGroup(cloup.Group):
|
|||
decorator = super().command(*args, **kwargs)
|
||||
if not default:
|
||||
return decorator
|
||||
logger.log(
|
||||
"Use default param of DefaultGroup or " "set_default_command() instead",
|
||||
warnings.warn(
|
||||
"Use default param of DefaultGroup or set_default_command() instead",
|
||||
DeprecationWarning,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ def select_resolution():
|
|||
resolution_options.pop()
|
||||
choice = click.prompt(
|
||||
"\nSelect resolution:\n",
|
||||
type=click.Choice([f"{i[0]}p" for i in resolution_options]),
|
||||
type=cloup.Choice([f"{i[0]}p" for i in resolution_options]),
|
||||
show_default=False,
|
||||
default="480p",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def select_resolution():
|
|||
resolution_options.pop()
|
||||
choice = click.prompt(
|
||||
"\nSelect resolution:\n",
|
||||
type=click.Choice([f"{i[0]}p" for i in resolution_options]),
|
||||
type=cloup.Choice([f"{i[0]}p" for i in resolution_options]),
|
||||
show_default=False,
|
||||
default="480p",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,13 +7,15 @@ can specify options, and arguments for the render command.
|
|||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import http.client
|
||||
import json
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
from typing import cast
|
||||
|
||||
import click
|
||||
import cloup
|
||||
import requests
|
||||
|
||||
from ... import __version__, config, console, error_console, logger
|
||||
from ..._config import tempconfig
|
||||
|
|
@ -30,8 +32,8 @@ from .render_options import render_options
|
|||
no_args_is_help=True,
|
||||
epilog=EPILOG,
|
||||
)
|
||||
@click.argument("file", type=Path, required=True)
|
||||
@click.argument("scene_names", required=False, nargs=-1)
|
||||
@cloup.argument("file", type=Path, required=True)
|
||||
@cloup.argument("scene_names", required=False, nargs=-1)
|
||||
@global_options
|
||||
@output_options
|
||||
@render_options # type: ignore
|
||||
|
|
@ -120,30 +122,32 @@ def render(
|
|||
if config.notify_outdated_version:
|
||||
manim_info_url = "https://pypi.org/pypi/manim/json"
|
||||
warn_prompt = "Cannot check if latest release of manim is installed"
|
||||
req_info = {}
|
||||
|
||||
try:
|
||||
req_info = requests.get(manim_info_url, timeout=10)
|
||||
req_info.raise_for_status()
|
||||
|
||||
stable = req_info.json()["info"]["version"]
|
||||
if stable != __version__:
|
||||
console.print(
|
||||
f"You are using manim version [red]v{__version__}[/red], but version [green]v{stable}[/green] is available.",
|
||||
)
|
||||
console.print(
|
||||
"You should consider upgrading via [yellow]pip install -U manim[/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}")
|
||||
with urllib.request.urlopen(
|
||||
urllib.request.Request(manim_info_url),
|
||||
timeout=10,
|
||||
) as response:
|
||||
response = cast(http.client.HTTPResponse, response)
|
||||
json_data = json.loads(response.read())
|
||||
except urllib.error.HTTPError:
|
||||
logger.debug("HTTP Error: %s", warn_prompt)
|
||||
except urllib.error.URLError:
|
||||
logger.debug("URL Error: %s", warn_prompt)
|
||||
except json.JSONDecodeError:
|
||||
logger.debug(warn_prompt)
|
||||
logger.debug(f"Error decoding JSON from {manim_info_url}")
|
||||
logger.debug(
|
||||
"Error while decoding JSON from %r: %s", manim_info_url, warn_prompt
|
||||
)
|
||||
except Exception:
|
||||
logger.debug(f"Something went wrong: {warn_prompt}")
|
||||
logger.debug("Something went wrong: %s", warn_prompt)
|
||||
|
||||
stable = json_data["info"]["version"]
|
||||
if stable != __version__:
|
||||
console.print(
|
||||
f"You are using manim version [red]v{__version__}[/red], but version [green]v{stable}[/green] is available.",
|
||||
)
|
||||
console.print(
|
||||
"You should consider upgrading via [yellow]pip install -U manim[/yellow]",
|
||||
)
|
||||
|
||||
return args
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import click
|
||||
from cloup import option, option_group
|
||||
from cloup import Choice, option, option_group
|
||||
|
||||
ease_of_access_options = option_group(
|
||||
"Ease of access options",
|
||||
|
|
@ -9,7 +8,7 @@ ease_of_access_options = option_group(
|
|||
"--progress_bar",
|
||||
default=None,
|
||||
show_default=False,
|
||||
type=click.Choice(
|
||||
type=Choice(
|
||||
["display", "leave", "none"],
|
||||
case_sensitive=False,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import click
|
||||
from cloup import option, option_group
|
||||
from cloup import Choice, option, option_group
|
||||
|
||||
from ... import logger
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from cloup._option_groups import OptionGroupDecorator
|
||||
|
||||
|
||||
def validate_gui_location(ctx, param, value):
|
||||
if value:
|
||||
|
|
@ -22,7 +17,7 @@ def validate_gui_location(ctx, param, value):
|
|||
exit()
|
||||
|
||||
|
||||
global_options: OptionGroupDecorator = option_group(
|
||||
global_options = option_group(
|
||||
"Global options",
|
||||
option(
|
||||
"-c",
|
||||
|
|
@ -53,7 +48,7 @@ global_options: OptionGroupDecorator = option_group(
|
|||
option(
|
||||
"-v",
|
||||
"--verbosity",
|
||||
type=click.Choice(
|
||||
type=Choice(
|
||||
["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
||||
case_sensitive=False,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import click
|
||||
from cloup import option, option_group
|
||||
from cloup import IntRange, Path, option, option_group
|
||||
|
||||
output_options = option_group(
|
||||
"Output options",
|
||||
|
|
@ -15,7 +14,7 @@ output_options = option_group(
|
|||
option(
|
||||
"-0",
|
||||
"--zero_pad",
|
||||
type=click.IntRange(0, 9),
|
||||
type=IntRange(0, 9),
|
||||
default=None,
|
||||
help="Zero padding for PNG file names.",
|
||||
),
|
||||
|
|
@ -27,13 +26,13 @@ output_options = option_group(
|
|||
),
|
||||
option(
|
||||
"--media_dir",
|
||||
type=click.Path(),
|
||||
type=Path(),
|
||||
default=None,
|
||||
help="Path to store rendered videos and latex.",
|
||||
),
|
||||
option(
|
||||
"--log_dir",
|
||||
type=click.Path(),
|
||||
type=Path(),
|
||||
help="Path to store render logs.",
|
||||
default=None,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import re
|
||||
|
||||
import click
|
||||
from cloup import option, option_group
|
||||
from cloup import Choice, option, option_group
|
||||
|
||||
from manim.constants import QUALITIES, RendererType
|
||||
|
||||
|
|
@ -55,7 +54,7 @@ render_options = option_group(
|
|||
),
|
||||
option(
|
||||
"--format",
|
||||
type=click.Choice(["png", "gif", "mp4", "webm", "mov"], case_sensitive=False),
|
||||
type=Choice(["png", "gif", "mp4", "webm", "mov"], case_sensitive=False),
|
||||
default=None,
|
||||
),
|
||||
option("-s", "--save_last_frame", is_flag=True, default=None),
|
||||
|
|
@ -63,7 +62,7 @@ render_options = option_group(
|
|||
"-q",
|
||||
"--quality",
|
||||
default=None,
|
||||
type=click.Choice(
|
||||
type=Choice(
|
||||
list(reversed([q["flag"] for q in QUALITIES.values() if q["flag"]])), # type: ignore
|
||||
case_sensitive=False,
|
||||
),
|
||||
|
|
@ -95,7 +94,7 @@ render_options = option_group(
|
|||
),
|
||||
option(
|
||||
"--renderer",
|
||||
type=click.Choice(
|
||||
type=Choice(
|
||||
[renderer_type.value for renderer_type in RendererType],
|
||||
case_sensitive=False,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -944,7 +944,9 @@ class OpenGLVMobject(OpenGLMobject):
|
|||
|
||||
curves_and_lengths = tuple(self.get_curve_functions_with_lengths())
|
||||
|
||||
target_length = alpha * np.sum(length for _, length in curves_and_lengths)
|
||||
target_length = alpha * np.sum(
|
||||
np.fromiter((length for _, length in curves_and_lengths), dtype=np.float64)
|
||||
)
|
||||
current_length = 0
|
||||
|
||||
for curve, length in curves_and_lengths:
|
||||
|
|
|
|||
2872
poetry.lock
generated
2872
poetry.lock
generated
File diff suppressed because it is too large
Load diff
141
pyproject.toml
141
pyproject.toml
|
|
@ -27,86 +27,67 @@ packages = [
|
|||
]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.8,<3.13"
|
||||
click = ">=7.2,<=9.0"
|
||||
click-default-group = "^1.2.2"
|
||||
numpy = [
|
||||
{ version = "^1.22", python = "<3.12" },
|
||||
{ version = "^1.26", python = ">=3.12" }
|
||||
]
|
||||
Pillow = ">=9.1,<10.0"
|
||||
scipy = [
|
||||
{ version = "^1.7.3", python = "<3.12" },
|
||||
{ version = "^1.11", python = ">=3.12" }
|
||||
]
|
||||
tqdm = "^4.62.3"
|
||||
pydub = "^0.25.1"
|
||||
python = ">=3.9,<3.13"
|
||||
click = ">=8.0"
|
||||
cloup = ">=2.0.0"
|
||||
dearpygui = { version = ">=1.0.0", optional = true }
|
||||
decorator = ">=4.3.2"
|
||||
isosurfaces = ">=0.1.0"
|
||||
jupyterlab = { version = ">=3.0.0", optional = true }
|
||||
manimpango = ">=0.5.0,<1.0.0" # Complete API change in 1.0.0
|
||||
mapbox-earcut = ">=1.0.0"
|
||||
moderngl = ">=5.0.0,<6.0.0"
|
||||
moderngl-window = ">=2.0.0"
|
||||
networkx = ">=2.6"
|
||||
notebook = { version = ">=6.0.0", optional = true }
|
||||
numpy = ">=1.26"
|
||||
Pillow = ">=9.1"
|
||||
pycairo = ">=1.13,<2.0.0"
|
||||
pydub = ">=0.20.0"
|
||||
Pygments = ">=2.0.0"
|
||||
rich = ">=12.0.0"
|
||||
pycairo = "^1.21"
|
||||
manimpango = ">=0.5.0,<1.0.0"
|
||||
networkx = ">=2.5,<3.3"
|
||||
decorator = "^5.0.7"
|
||||
importlib-metadata = { version = "^4.10.0", python = "<3.8" }
|
||||
watchdog = ">=2.1,<=3.0.0"
|
||||
jupyterlab = { version = "^3.0", optional = true }
|
||||
notebook = { version = "^6.4", optional = true }
|
||||
moderngl = "^5.6.3"
|
||||
moderngl-window = "^2.3.0"
|
||||
mapbox-earcut = "^1.0.0"
|
||||
cloup = ">=0.13,<2.2"
|
||||
requests = "^2.26.0"
|
||||
dearpygui = { version = "^1.3.1", optional = true }
|
||||
skia-pathops = [
|
||||
{ version = "^0.7.0", python = "<3.12" },
|
||||
{ version = "^0.8.0.post1", python = ">=3.12" }
|
||||
]
|
||||
isosurfaces = "0.1.0"
|
||||
srt = "^3.5.0"
|
||||
screeninfo = "^0.8"
|
||||
Pygments = "^2.10.0"
|
||||
"backports.cached-property" = { version = "^1.0.1", python = "<3.8" }
|
||||
svgelements = "^1.8.0"
|
||||
typing-extensions = "^4.7.1"
|
||||
scipy = ">=1.6.0"
|
||||
screeninfo = ">=0.7"
|
||||
skia-pathops = ">=0.7.0"
|
||||
srt = ">=3.0.0"
|
||||
svgelements = ">=1.8.0"
|
||||
tqdm = ">=4.0.0"
|
||||
typing-extensions = ">=4.0.0"
|
||||
watchdog = ">=2.0.0"
|
||||
|
||||
[tool.poetry.extras]
|
||||
jupyterlab = ["jupyterlab", "notebook"]
|
||||
gui = ["dearpygui"]
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pytest-cov = "^3.0.0"
|
||||
pytest = "^7.2"
|
||||
pylint = "^2.12.2"
|
||||
Sphinx = "^4"
|
||||
sphinx-copybutton = "^0.4.0"
|
||||
sphinxext-opengraph = "^0.8"
|
||||
furo = "^2022.06.21"
|
||||
recommonmark = "^0.7.1"
|
||||
matplotlib = "^3.3.2"
|
||||
pre-commit = "^2.11.1"
|
||||
gitpython = "^3"
|
||||
pygithub = "^1"
|
||||
flake8 = "^3.9.0"
|
||||
isort = "^5.8.0"
|
||||
pytest-xdist = "^2.2"
|
||||
types-requests = "^2.25.6"
|
||||
types-protobuf = "^3.17.4"
|
||||
types-decorator = "^0.1.7"
|
||||
types-setuptools = "^57.0.2"
|
||||
types-Pillow = "^9.3.0.4"
|
||||
types-Pygments = "^2.9.2"
|
||||
flake8-builtins = "^1.5.3"
|
||||
flake8-bugbear = "^21.4.3"
|
||||
flake8-docstrings = "^1.6.0"
|
||||
flake8-rst-docstrings = "^0.2.3"
|
||||
flake8-pytest-style = "^1.5.0"
|
||||
flake8-simplify = "^0.14.1"
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
black = "^23.11.0"
|
||||
flake8 = "^6.1.0"
|
||||
flake8-bugbear = "^23.11.28"
|
||||
flake8-builtins = "^2.2.0"
|
||||
flake8-comprehensions = "^3.7.0"
|
||||
sphinxcontrib-programoutput = "^0.17"
|
||||
data-science-types = "^0.2.23"
|
||||
psutil-wheels = {version = "5.8.0", python = ">=3.10"}
|
||||
psutil = {version = "^5.8.0", python = "<3.10"}
|
||||
flake8-docstrings = "^1.7.0"
|
||||
flake8-pytest-style = "^1.7.2"
|
||||
flake8-simplify = "^0.14.1"
|
||||
flake8-rst-docstrings = "^0.3.0"
|
||||
furo = "^2022.06.21"
|
||||
gitpython = "^3"
|
||||
isort = "^5.12.0"
|
||||
matplotlib = "^3.8.2"
|
||||
myst-parser = "^0.17.2"
|
||||
|
||||
pre-commit = "^3.5.0"
|
||||
psutil = {version = "^5.8.0", python = "<3.10"}
|
||||
psutil-wheels = {version = "5.8.0", python = ">=3.10"}
|
||||
pytest = "^7.4.3"
|
||||
pygithub = "^2.1.1"
|
||||
pytest-cov = "^4.1.0"
|
||||
pytest-xdist = "^2.2" # Using latest gives flaky tests
|
||||
Sphinx = "^4"
|
||||
sphinx-copybutton = "^0.5.2"
|
||||
sphinxcontrib-programoutput = "^0.17"
|
||||
sphinxext-opengraph = "^0.9.0"
|
||||
types-decorator = "^0.1.7"
|
||||
types-Pillow = "^10.1.0.2"
|
||||
types-Pygments = "^2.17.0.0"
|
||||
|
||||
[tool.poetry.urls]
|
||||
"Bug Tracker" = "https://github.com/ManimCommunity/manim/issues"
|
||||
|
|
@ -114,24 +95,12 @@ myst-parser = "^0.17.2"
|
|||
"Twitter" = "https://twitter.com/manim_community"
|
||||
"Discord" = "https://www.manim.community/discord/"
|
||||
|
||||
[tool.poetry.dev-dependencies.black]
|
||||
version = ">=20.8b1"
|
||||
allow-prereleases = false
|
||||
python = "^3.6"
|
||||
markers = "platform_python_implementation == 'CPython'"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
markers = "slow: Mark the test as slow. Can be skipped with --skip_slow"
|
||||
addopts = "--no-cov-on-fail --cov=manim --cov-report xml --cov-report term -n auto --dist=loadfile --durations=0"
|
||||
|
||||
[tool.isort]
|
||||
# from https://black.readthedocs.io/en/stable/compatible_configs.html
|
||||
multi_line_output = 3
|
||||
include_trailing_comma = true
|
||||
force_grid_wrap = 0
|
||||
use_parentheses = true
|
||||
ensure_newline_before_comments = true
|
||||
line_length = 88
|
||||
profile = "black"
|
||||
|
||||
[tool.coverage.run]
|
||||
omit = ["*tests*"]
|
||||
|
|
@ -145,5 +114,5 @@ exclude_lines = ["pragma: no cover"]
|
|||
"manimce" = "manim.__main__:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools","poetry-core>=1.0.0"]
|
||||
requires = ["setuptools", "poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ from collections import defaultdict
|
|||
from pathlib import Path
|
||||
from textwrap import dedent, indent
|
||||
|
||||
import click
|
||||
import cloup
|
||||
from git import Repo
|
||||
from github import Github
|
||||
|
|
@ -192,16 +191,16 @@ def get_summary(body):
|
|||
context_settings=CONTEXT_SETTINGS,
|
||||
epilog=EPILOG,
|
||||
)
|
||||
@click.argument("token")
|
||||
@click.argument("prior")
|
||||
@click.argument("tag")
|
||||
@click.argument(
|
||||
@cloup.argument("token")
|
||||
@cloup.argument("prior")
|
||||
@cloup.argument("tag")
|
||||
@cloup.argument(
|
||||
"additional",
|
||||
nargs=-1,
|
||||
required=False,
|
||||
type=int,
|
||||
)
|
||||
@click.option(
|
||||
@cloup.option(
|
||||
"-o",
|
||||
"--outfile",
|
||||
type=str,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pkg_resources
|
||||
from importlib.metadata import version
|
||||
|
||||
from manim import __name__, __version__
|
||||
|
||||
|
||||
def test_version():
|
||||
assert __version__ == pkg_resources.get_distribution(__name__).version
|
||||
assert __version__ == version(__name__)
|
||||
|
|
|
|||
|
|
@ -37,58 +37,58 @@ def test_background_color(using_opengl_renderer):
|
|||
def test_set_color(using_opengl_renderer):
|
||||
m = OpenGLMobject()
|
||||
assert m.color.to_hex() == "#FFFFFF"
|
||||
np.alltrue(m.rgbas == np.array((0.0, 0.0, 0.0, 1.0)))
|
||||
np.all(m.rgbas == np.array((0.0, 0.0, 0.0, 1.0)))
|
||||
|
||||
m.set_color(BLACK)
|
||||
assert m.color.to_hex() == "#000000"
|
||||
np.alltrue(m.rgbas == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
np.all(m.rgbas == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
|
||||
m.set_color(PURE_GREEN, opacity=0.5)
|
||||
assert m.color.to_hex() == "#00FF00"
|
||||
np.alltrue(m.rgbas == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
np.all(m.rgbas == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
|
||||
m = OpenGLVMobject()
|
||||
assert m.color.to_hex() == "#FFFFFF"
|
||||
np.alltrue(m.fill_rgba == np.array((0.0, 0.0, 0.0, 1.0)))
|
||||
np.alltrue(m.stroke_rgba == np.array((0.0, 0.0, 0.0, 1.0)))
|
||||
np.all(m.fill_rgba == np.array((0.0, 0.0, 0.0, 1.0)))
|
||||
np.all(m.stroke_rgba == np.array((0.0, 0.0, 0.0, 1.0)))
|
||||
|
||||
m.set_color(BLACK)
|
||||
assert m.color.to_hex() == "#000000"
|
||||
np.alltrue(m.fill_rgba == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
np.alltrue(m.stroke_rgba == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
np.all(m.fill_rgba == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
np.all(m.stroke_rgba == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
|
||||
m.set_color(PURE_GREEN, opacity=0.5)
|
||||
assert m.color.to_hex() == "#00FF00"
|
||||
np.alltrue(m.fill_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
np.alltrue(m.stroke_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
np.all(m.fill_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
np.all(m.stroke_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
|
||||
|
||||
def test_set_fill_color(using_opengl_renderer):
|
||||
m = OpenGLVMobject()
|
||||
assert m.fill_color.to_hex() == "#FFFFFF"
|
||||
np.alltrue(m.fill_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
np.all(m.fill_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
|
||||
m.set_fill(BLACK)
|
||||
assert m.fill_color.to_hex() == "#000000"
|
||||
np.alltrue(m.fill_rgba == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
np.all(m.fill_rgba == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
|
||||
m.set_fill(PURE_GREEN, opacity=0.5)
|
||||
assert m.fill_color.to_hex() == "#00FF00"
|
||||
np.alltrue(m.fill_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
np.all(m.fill_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
|
||||
|
||||
def test_set_stroke_color(using_opengl_renderer):
|
||||
m = OpenGLVMobject()
|
||||
assert m.stroke_color.to_hex() == "#FFFFFF"
|
||||
np.alltrue(m.stroke_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
np.all(m.stroke_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
|
||||
m.set_stroke(BLACK)
|
||||
assert m.stroke_color.to_hex() == "#000000"
|
||||
np.alltrue(m.stroke_rgba == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
np.all(m.stroke_rgba == np.array((1.0, 1.0, 1.0, 1.0)))
|
||||
|
||||
m.set_stroke(PURE_GREEN, opacity=0.5)
|
||||
assert m.stroke_color.to_hex() == "#00FF00"
|
||||
np.alltrue(m.stroke_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
np.all(m.stroke_rgba == np.array((0.0, 1.0, 0.0, 0.5)))
|
||||
|
||||
|
||||
def test_set_fill(using_opengl_renderer):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue