-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipython_magic.py essential changes: #3628
base: main
Are you sure you want to change the base?
ipython_magic.py essential changes: #3628
Conversation
Changes made to existing cell magic that ignored config.media_embed changes after manim refactoring Additional feature for %manim --quick-setup line magic added to ipython_magic.py
for more information, see https://pre-commit.ci
# def load_ipython_extension(ipython): | ||
# """ | ||
# Any module file that define a function named `load_ipython_extension` | ||
# can be loaded via `%load_ext module.path` or be configured to be | ||
# autoloaded by IPython at startup time. | ||
# """ | ||
# # You can register the class itself without instantiating it. | ||
# # IPython will call the default constructor on it. | ||
# ipython.register_magics(ManimMagic) | ||
# print("Manim Magics class imported") |
Check notice
Code scanning / CodeQL
Commented-out code Note
import json | ||
import os | ||
import re | ||
import sys |
Check notice
Code scanning / CodeQL
Unused import Note
replaced inifity by infinity - codespell/flake CI checks
removed unnecessary comments
changed `input(f"config.verbosity = ")` to `input("config.verbosity = ")`
changed `if not backgroundColor.upper() in vars(manim_colors):` to `if backgroundColor.upper() not in vars(manim_colors):`
changed `def is_percent(number): if "%" in number: return True else: return False ` and `def is_percent(number): if "%" in number: return True else: return False ` to `def is_float(number): return "." in number: ` and `def is_percent(number): return "%" in number `
Oops, forgot to remove : after line 334
for more information, see https://pre-commit.ci
Fix for flake8 C408 Unnecessary dict call - rewrite as a literal. 1 C408 Unnecessary dict call - rewrite as a literal.
Changes to dictionary syntax - obv!!!
for more information, see https://pre-commit.ci
Replace existing broken config_low_q.gif
Remove to replace broken file
gif illustrating use of %manim --quick-setup line magic
Would you like to elaborate on your changes and why you did them? Please note, that if a PR is not ready for review you can mark it as draft. Thanks for participating in contributing to Manim ✨ |
@MrDiver Please see the updated markdown |
Part of this PR seems to be based on a misunderstanding (caused by the The If In the special case of The documentation of this config option should be made more clear to reflect this. The Can you explain the usecase for the quickstart via the |
Changes made to existing
%manim
cell magic that previously ignoredconfig.media_embed
settings after manim refactoringAdditional feature for
%manim --quick-setup (--accept-default)
line magic added to ipython_magic.pyOverview: What does this pull request change?
The current state of manim's ipython_magic.py cell magic command ignores whether or not the config switch
config.media_embed
is set to eithertrue
orfalse
and embeds the media into the .ipynb notebook in any case. Whether or not themedia_embed
attribute is set totrue
orfalse
is irrelevant to the current state of ipython_magic.py and does not respect the encoded boolean choice, thus loading the media into the .ipynb view, regardless of the user's choicemedia_embed = true/false
. This is due to recent changes of themedia_embed
config option, which originally could be aNone
type, but is now required to be aboolean
type.Motivation and Explanation: Why and how do your changes improve the library?
The proposed changes takes care of the persisting problem that
media_embed
config attribute is responsible for updating the .ipynb view by simply adding the check at lines 238-239:Some extras have been included which can be seen as a gif or as an .ipynb notebook file
from manim import *
%manim --quick-setup
which provides a "GUI"/front-end prompt-like command-line/terminal-style project config/setup "REPL" to allow users to specify the scene options (background color, media_width etc..), project settings (project name, media directory, including video, images, tex, text, etc ...) and other scene & config options such as whether to importmanimpango
or not.manim --quick-setup
is completed, then the cell is populated with a demo manim screen resolution scene upon completion of prompt input, onto which the config settings from step 2 is applied and the line magic is auto-commented# %manim --quick-setup
%manim --quick-setup --accept-default
takes all the pre-defined/default config settings into account when creating a new manim project via the ipython notebook front-end and populates the .ipynb cell with the code for the demo manim screen resolution scene and auto-comments the line magic# %manim --quick-setup --accept-default
The code for the default scene is pulled from the 'local' file manim/manim/templates
Links to added or changed documentation pages
Further Information and Comments
Reviewer Checklist