-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Added media_embed
config option to control whether media in Jupyter notebooks is embedded
#2442
Conversation
I think the code is complete, but need to figure out how to write tests. Also, I have slightly abused |
Any suggestions on how to test this change would be appreciated. Only the |
In principle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this looks good to me, thank you for your contribution!
I am somewhat on the fence regarding the Jupyter-only implementation of --embed
, and I think that given the fact that stuff like media_width
also is a proper configuration option it would be more consistent to do so here as well. What do you (or other devs) think about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have thought about it some more, and I think introducing jupyter-only flags is a bad idea overall. This should be implemented as a proper config option, just like media_width
. Perhaps also renamed to media_embed
.
In case there is no reaction here, I'll look into it.
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Okay, I took a stab at making |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your efforts! There are two problems that should be addressed:
- In
default.cfg
,media_embed
should not be assigned a value (otherwise it will be false by default); just putmedia_embed =
. - The value from the default config currently get read and parsed as strings, you can check that
python -c "from manim import config; config.media_embed"
yields the string"False"
. The logic inutils.py
needs to be adapted: after changing the value indefault.cfg
the default case will be thatparser["jupyter"].get("media_embed")
will yield the empty string""
.
What do you think?
I went ahead and fixed the issues raised in my code review via 1ec2017 -- from my point of view, this is good to go now. Thanks again for your efforts! |
media_embed
config option to control whether media in Jupyter notebooks is embedded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
This seems to have broken preview in jupyter notebooks. |
Overview: What does this pull request change?
Adds a
--embed
option to the%%manim
magic that will embed the video data.Resolves #2441, #2416.
Motivation and Explanation: Why and how do your changes improve the library?
Currently video data is embedded only if running on Google's CoLab platform, but there are other use-cases (relocatable notebooks) and this should be customizable.
Links to added or changed documentation pages
Further Information and Comments
Reviewer Checklist