Skip to content
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

Update ipython_magic.py #3618

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lambdadotjoburg
Copy link

@lambdadotjoburg lambdadotjoburg commented Feb 13, 2024

Check whether local_path provided by output_file is not absolute, in which case make path relative_to curr-ent directory, otherwise provide user flexibility to specify where media_embed is to be retrieved from, outside of relative path

Overview: What does this pull request change?

added the check at lines 159-161:

                local_path = Path(config["output_file"])
                if not Path(config["output_file"]).is_absolute():
                    local_path = Path(config["output_file"]).relative_to(Path.cwd())

This allows the user to retrieve media from outside the project root, for embedding into the .ipynb view

Motivation and Explanation: Why and how do your changes improve the library?

The current state of the ipython_magic.py file does not allow discovering media outside of the project root for embedding into the .ipynb view. The proposed changes addresses this defect.

Links to added or changed documentation pages

Further Information and Comments

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

lambdadotjoburg and others added 2 commits February 13, 2024 12:46
Check whether local_path provided by output_file is not absolute, in which case make path relative_to current directory, otherwise provide user flexibility to specify where media_embed is to be retrieved from, outside of relative path
Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Could you please describe the issue you are fixing with this change with a few more details, ideally so that we can reproduce the problem? (We might want to add a test for this too, depending on the exact problem.)

manim/utils/ipython_magic.py Outdated Show resolved Hide resolved
oh yes, clearly/obv.

Co-authored-by: Benjamin Hackl <[email protected]>
@lambdadotjoburg
Copy link
Author

@behackl

Please see the updated markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

None yet

2 participants