mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 02:35:22 +08:00
Have autoreload update shell namespace with reloaded module variables (#2278)
* Have autoreload update shell namespace with reloaded module variables * Update comments
This commit is contained in:
@ -63,7 +63,7 @@ flag abbr function
|
|||||||
``--video_dir VIDEO_DIR`` Directory to write video
|
``--video_dir VIDEO_DIR`` Directory to write video
|
||||||
``--config_file CONFIG_FILE`` Path to the custom configuration file
|
``--config_file CONFIG_FILE`` Path to the custom configuration file
|
||||||
``--log-level LOG_LEVEL`` Level of messages to Display, can be DEBUG / INFO / WARNING / ERROR / CRITICAL
|
``--log-level LOG_LEVEL`` Level of messages to Display, can be DEBUG / INFO / WARNING / ERROR / CRITICAL
|
||||||
``--autoreload`` Automatically reload Python modules to pick up code changes across different files
|
``--autoreload`` Automatically reload Python modules to pick up code changes across during an interactive embedding
|
||||||
========================================================== ====== =====================================================================================================================================================================================================
|
========================================================== ====== =====================================================================================================================================================================================================
|
||||||
|
|
||||||
custom_config
|
custom_config
|
||||||
|
@ -142,9 +142,12 @@ class InteractiveSceneEmbed:
|
|||||||
self.shell.run_line_magic("exit_raise", "")
|
self.shell.run_line_magic("exit_raise", "")
|
||||||
|
|
||||||
def auto_reload(self):
|
def auto_reload(self):
|
||||||
"""Enables IPython autoreload for automatic reloading of modules."""
|
"""Enables reload the shell's module before all calls"""
|
||||||
self.shell.magic("load_ext autoreload")
|
def pre_cell_func(*args, **kwargs):
|
||||||
self.shell.magic("autoreload all")
|
new_mod = ModuleLoader.get_module(self.shell.user_module.__file__, is_during_reload=True)
|
||||||
|
self.shell.user_ns.update(vars(new_mod))
|
||||||
|
|
||||||
|
self.shell.events.register("pre_run_cell", pre_cell_func)
|
||||||
|
|
||||||
def checkpoint_paste(
|
def checkpoint_paste(
|
||||||
self,
|
self,
|
||||||
|
Reference in New Issue
Block a user