-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): add render command as alias to
manim render
(#317)
* feat(cli): add render command as alias to `manim render` * feat(cli): add render command as alias to `manim render` * chore(test): add test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore(lib): simplify how ManimGL rendering is called * chore(lib): test * chore(ci): try identify error * wip * chore(test): add result output * try: checkout * Revert "try: checkout" This reverts commit 60985f0. * fix(deps): don't update lock * chore(lib): simplify code and improve usage * chore(cli): better cli * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: does this fix? --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
891273b
commit ce799ae
Showing
10 changed files
with
109 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
Alias command to either | ||
``manim render [OPTIONS] [ARGS]...`` or | ||
``manimgl [OPTIONS] [ARGS]...``. | ||
This is especially useful for two reasons: | ||
1. You can are sure to execute the rendering command with the same Python environment | ||
as for ``manim-slides``. | ||
2. You can pass options to the config. | ||
""" | ||
|
||
import subprocess | ||
import sys | ||
from typing import Tuple | ||
|
||
import click | ||
|
||
|
||
@click.command( | ||
context_settings=dict( | ||
ignore_unknown_options=True, allow_extra_args=True, help_option_names=("-h",) | ||
), | ||
options_metavar="[-h] [--CE|--GL]", | ||
) | ||
@click.option( | ||
"--CE", | ||
is_flag=True, | ||
envvar="MANIM_RENDERER", | ||
show_envvar=True, | ||
help="If set, use Manim Community Edition (CE) renderer. " | ||
"If this or --GL is not set, default to CE renderer.", | ||
) | ||
@click.option( | ||
"--GL", | ||
is_flag=True, | ||
envvar="MANIMGL_RENDERER", | ||
show_envvar=True, | ||
help="If set, use ManinGL renderer.", | ||
) | ||
@click.argument("args", metavar="[RENDERER_ARGS]...", nargs=-1, type=click.UNPROCESSED) | ||
def render(ce: bool, gl: bool, args: Tuple[str, ...]) -> None: | ||
""" | ||
Render SCENE(s) from the input FILE, using the specified renderer. | ||
Use 'manim-slides render --help' to see help information for | ||
a the specified renderer. | ||
""" | ||
if ce and gl: | ||
raise click.UsageError("You cannot specify both --CE and --GL renderers.") | ||
if gl: | ||
subprocess.run([sys.executable, "-m", "manimlib", *args]) | ||
else: | ||
subprocess.run([sys.executable, "-m", "manim", "render", *args]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters